-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add docstyle rule to the linter and subsequent refactor. #4311
Conversation
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.
Awesome!
I added places where the summary line doesn't follow the style guide (I wish the linter would catch that!):
https://google.github.io/styleguide/pyguide.html#381-docstrings - "...A docstring should be organized as a summary line (one physical line not exceeding 80 characters) terminated by a period, question mark, or exclamation point..."
@@ -190,8 +184,7 @@ def validate_operation(self, operation: ops.Operation): | |||
raise ValueError("Bad number of XY gates in parallel") | |||
|
|||
def validate_moment(self, moment: ops.Moment): | |||
""" | |||
Raises an error if the given moment is invalid on this device | |||
"""Raises an error if the given moment is invalid on this device |
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.
fix summary line, add Raises:
instead
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.
ditto
Thanks @balopat . Since this is such a big change, I'm trying to keep all my changes trivial. For the non-trivial cases, what do you think about me adding a TODO to update the docstring with a summary line? |
Sounds good to me. A TODO + disabling pylint is better than a bad update. |
3797b35
to
683e2be
Compare
@balopat Thanks again for bearing with me. I think this lint rule will be nice once it's running. I've taken care of your suggestions, take a look. |
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.
LGTM
…4311) Associated to: quantumlib#3388 Added the docstyle linter and refactored trivial pydocs. If the refactor wasn't trivial I just disable the rule for the pydoc. We'll need to add the docparams plugin in a later PR.
…4311) Associated to: quantumlib#3388 Added the docstyle linter and refactored trivial pydocs. If the refactor wasn't trivial I just disable the rule for the pydoc. We'll need to add the docparams plugin in a later PR.
Associated to: #3388
Added the docstyle linter and refactored trivial pydocs. If the refactor wasn't trivial I just disable the rule for the pydoc.
We'll need to add the docparams plugin in a later PR.