-
Notifications
You must be signed in to change notification settings - Fork 189
Report docstring content violations on docstring line (fixes #83) #238
Conversation
the start and end of the token. | ||
|
||
""" | ||
def __new__(cls, v, start, end): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed? Why not just call super
in __init__
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC, you can't subclass various native types without defining new().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I confirmed, this is needed.
Bump. Is merging this blocked by #240? |
Disappointed this didn't make 2.0.0. Please let me know what needs to happen for this to be merged. |
@lordmauve sorry about that. I think this will go in the next minor version. |
0788aba
to
501b6f4
Compare
I just rebased. @Nurdok, can this be merged? |
Hi @lordmauve, can you please just add a line to the release notes first? |
I've added to the notes under a new minor version number. The release date will need to be added when you come to release this. |
docs/release_notes.rst
Outdated
@@ -4,6 +4,14 @@ Release Notes | |||
**pydocstyle** version numbers follow the | |||
`Semantic Versioning <http://semver.org/>`_ specification. | |||
|
|||
2.2.0 - not yet released |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just put "Current Development Version" in the title instead of specifying the actual version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
docs/release_notes.rst
Outdated
New features | ||
|
||
* Violations are now reported on the line where the docstring starts, not the | ||
line of the ``def``/``class`` it corresponds to. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Merged. @lordmauve, thank you so much for your patience, and for putting in the time to do this! |
Add
.start
and.end
attributes to docstring objects that hold the starting and ending line numbers of the docstring token. Docstring was changed to a subclass of str to allow this, ensuring backwards compatibility.Add a property
.error_lineno
to Definition. This will use the docstring's line number if it exists, or the definition's line number otherwise.Finally, switch
Error
to use the new.error_lineno
property.Tested on Python 2.7, 3.3-3.5 and PyPy with Tox.