Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix documentation of non-existing parameters #1485

Merged
merged 4 commits into from
Nov 27, 2020

Conversation

mthuurne
Copy link
Contributor

@mthuurne mthuurne commented Nov 27, 2020

Contributor Checklist:


Something I noticed while doing this is that ITransport.writeSequence() uses data as its argument name, but a lot of implementations use different names such as seq and iovec. I think these should be considered bugs, since these arguments can currently only be passed safely positionally, not via keywords. It will also cause problems once type annotations are added and mypy no longer ignores these methods.

This avoids a warning from pydoctor, which expects an '@type' field
in a function to match a parameter, not an instance variable.
The name was incorrect for the var-keyword parameter. The type was
incorrect as well: for the var-keyword parameter, the documented type
should be the value type, which is bytes/int in this case, not dict.
@adiroiban
Copy link
Member

I think these should be considered bugs, since these arguments can currently only be passed safely positionally, not via keywords.

+1 I think that zope mypy extension can detect this type of errors.

Copy link
Member

@adiroiban adiroiban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow. Great work. Thanks!

This can be merged.

Looking forward for updating pydoctor and have it fail on workings

RIght now, there are some warinings in pydoctor but the Documentation run is still green.

https://github.com/twisted/twisted/runs/1464285550#step:8:29

@mthuurne mthuurne merged commit cc71bf5 into trunk Nov 27, 2020
@mthuurne mthuurne deleted the 10059-nonexisting-params-in-docstrings branch November 27, 2020 16:17
@mthuurne
Copy link
Contributor Author

Looking forward for updating pydoctor and have it fail on workings

RIght now, there are some warinings in pydoctor but the Documentation run is still green.

https://github.com/twisted/twisted/runs/1464285550#step:8:29

We still have the issue that the processing order of circular dependencies can determine whether a reference is found or not. I'm not sure if that is the cause for this particular failure, but it could cause failures like this, in a flaky way.

So while I agree with the goal, I don't think activating "strict mode" is feasible yet with the upcoming pydoctor release. It will require bigger changes, such as separating the code model (implementation side) from the doc model (public API side).

@mthuurne
Copy link
Contributor Author

Looking at the error message, it does seem like this is an outdated version of pydoctor being used (we improved the phrasing of that particular message), so perhaps this error will be gone after updating.

@adiroiban
Copy link
Member

Looking at the error message, it does seem like this is an outdated version of pydoctor being used (we improved the phrasing of that particular message), so perhaps this error will be gone after updating.

Yep.
Right now twisted uses :

[testenv:apidocs]
deps=https://github.com/twisted/pydoctor/archive/3f9c64829dfa040b334c9ae27c332c7078356e79.zip

see https://github.com/twisted/twisted/blob/trunk/tox.ini#L135

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants