Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR lints docstrings using Ruff instead of pydocstyle. It also fixes ~40 style errors that pydocstyle previously did not catch.
This PR removes the dependency on pydocstyle which has been depreciated and is no longer maintained. Instead, we use Ruff, the recommended, drop-in replacement that is much faster and catches bugs pydocstyle misses.
Following the ruff docs, I migrated pydocstyle to ruff. It was pretty simple:
.pre-commit-config.yaml
and frompyproject.toml
.[tool.ruff.lint]
and[tool.ruff.lint.pycodestyle]
parts ofpyproject.toml
.To test things out, I installed pre-commit with the new changes and ran pre-commit on all the files in the repo. This caught several errors:
I believe pydocstyle simply failed to properly detect these errors because it is no longer maintained and ruff simply has a better implementation. I then resolved all of these errors.
Outside of these errors, which are relatively minor, it seems like ruff is enforcing the same format for docstrings as pydocstyle. However, this is not a guarantee that ruff works 100% the same as pydocstyle. I'm not sure if there is a way to test this outside of just running ruff like. I already did. Nonetheless, ruff is much faster and catches formatting errors that pydocstyle misses. So I think we should still switch to using ruff.
Note: There was also a comment in
pyproject.toml
to migratepydocstyle
toruff
-- this PR is taking care of that.