-
-
Notifications
You must be signed in to change notification settings - Fork 239
Enforce docstring max length consistency by ruff rule
#2452
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
base: master
Are you sure you want to change the base?
Enforce docstring max length consistency by ruff rule
#2452
Conversation
…ding `tool.ruff.lint.pycodestyle.max-doc-length` with default value 72 as per PEP8 recommendation Enforce docstring max length consistency by `ruff` rule
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2452 +/- ##
=======================================
Coverage 97.26% 97.26%
=======================================
Files 55 55
Lines 6299 6299
=======================================
Hits 6127 6127
Misses 172 172
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
sisp
left a comment
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.
Thanks for adding this Ruff rule to help us maintain consistent docstrings! 🙇 Definitely a 👍 from me. Just one inline comment regarding the maximum line length.
| convention = "google" | ||
|
|
||
| [tool.ruff.lint.pycodestyle] | ||
| max-doc-length = 72 |
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.
Should we make this 88? Ruff (and Black) diverge from PEP 8 regarding code line length and use 88. https://docs.astral.sh/ruff/settings/#lint_pycodestyle_max-doc-length shows an example with 88. Perhaps we can decide based on how re-formatted docstrings look with PEP 8's 72 characters or 88. I just wonder whether 72 might result in some too narrow and long text blocks.
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 personally do not mind long comment lines as I just word-wrap, but I am all for consistency and automation.
Thus, I shall let you decide what the best max length should be.
Just let me know ;)
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.
Okay, let's align max-doc-length with max-line-length, i.e. use 88 characters.
This PR adds
tool.ruff.lintruleW505(doc-line-too-long) with a correspondingtool.ruff.lint.pycodestyle.max-doc-lengthwith default value 72 as per PEP8 recommendation.This would enforce docstring max length consistency.
Note
If the PR gets green-lighted, I will add a commit to it that effectively applies the rule to all already existing docstrings.