-
-
Notifications
You must be signed in to change notification settings - Fork 74
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 ruff docstring linting and fix issues #979
Conversation
Co-authored-by: Simon Høxbro Hansen <[email protected]>
Co-authored-by: Maxime Liquet <[email protected]>
Co-authored-by: Maxime Liquet <[email protected]>
Co-authored-by: Maxime Liquet <[email protected]>
Co-authored-by: Philipp Rudiger <[email protected]>
…into enhancement/rx-docs
Co-authored-by: Maxime Liquet <[email protected]>
I've made some example fixes for errors identified by Ruff. I will ask for a quick, preliminary review because it will be a large amount of work to clean up 2200 errors. Are we OK with a change like this? |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #979 +/- ##
==========================================
- Coverage 87.26% 87.25% -0.02%
==========================================
Files 9 9
Lines 4948 4951 +3
==========================================
+ Hits 4318 4320 +2
- Misses 630 631 +1 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
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.
2200 errors
Woo! I'd suggest ignoring some rules to avoid having so many errors. For instance, if it complains about public API not having a docstring, let's ignore that for now, as adding docstrings everywhere will be a lot of work. Other than that, I'm fine in principle with this approach.
Oh and let's perhaps update the PR title not to say docstring tests
but docstring linting
as I don't think this is running any doctest, right?
I do plan to add the missing docstrings on public functions. It's what I want to achieve: that there is documentation. |
Nice! But I'd say it shouldn't be done in this PR, the goal of this PR should be to set up ruff linting for docstrings and ignore rules that make it fail. Then, you can gradually add docstrings and fix them in future PRs. If you do everything in a single PR, there's a big chance it will stall, as it's a lot of work to review. |
The problem is that I can't set ruff up for any docstring rule. It will fail no matter which rule is added. Ok I will add docstring rules one at a time if that is better for you. |
I'm not necessarily saying one rule at a time. It's just I'd like to avoid having to review all the docstrings of the complete API at once, as it's a lot, and I'm quite sure there are a few traps along the way that could slow you down or even block you entirely if done in one PR, while if you iterate we can be much more efficient and release improvements quickly. Some of the traps I think about:
|
Based on feedback I will close this one and add one micro rule at a time. |
Continues from #977.
This PR adds ruff docstring tests and cleans up.
More than 2200 docstring errors are identified by ruff. This will significantly change the wording and styling of the docstrings.
For example by adhering to
Please note. I've added a little bit of ruff docstring configuration to pyproject.toml. Should be aligned with #978.