Skip to content
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

Remove pydocstyle and configure ruff check for D rules #3384

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

eracah
Copy link
Contributor

@eracah eracah commented Jun 7, 2024

Pydocstyle is now deprecated, so we remove it and configure ruff to do what it did.

Our pydocstyle did the following:

  • used "google" style, which enforces all D rules except D203, D204, D213, D215, D400, D401, D404, D406, D407, D408, D409 and D413
  • ignores (adds to the the "google" style ignore list) D102, D105, D107, D401
  • selects (aka removes from the "google" style ignore list) D400, D404

To enable the above functionality in ruff, we:

  • select all D rules
  • ignore: D102, D105, D107, D203, D204, D213, D215, D401, D406, D407, D408, D409, D413
  • ignore 103 and 417 since those resulted in fresh errors when we disabled pydocstyle (so that means we didn't enforce them?)

Also:

  • a couple files got minor fixes with the new setup

@eracah eracah requested a review from a team as a code owner June 7, 2024 22:22
Copy link
Contributor

@mvpatel2000 mvpatel2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mvpatel2000 mvpatel2000 requested a review from b-chu June 8, 2024 02:52
"composer/algorithms/*" = ["D"]
"composer/datasets/*" = ["D"]
"composer/models/*" = ["D"]
"composer/trainer/activation_checkpointing.py" = ["D"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also just add a specific noqa comment at the top of the file to disable it directly in the file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why ignore algorithms/datasets/models?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just used the same ignoring that pydocstyle used. See the lines removed from the the pre-commit yaml

@Skylion007
Copy link
Contributor

Our ruff version is really old, we may want to consider updating it. It may include more pydocstyle autofixes in newer versions or reduce any false positives / false negatives

@@ -14,7 +14,7 @@
instances of the module type have been seen. The function should return a replacement
:class:`torch.nn.Module` if the module type should be replaced, or ``None`` otherwise.

Args:
Args:
module (torch.nn.Module): Source module
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird indenting here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it weird?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

module is double indented after Args

"composer/algorithms/*" = ["D"]
"composer/datasets/*" = ["D"]
"composer/models/*" = ["D"]
"composer/trainer/activation_checkpointing.py" = ["D"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why ignore algorithms/datasets/models?

Co-authored-by: Aaron Gokaslan <aaronGokaslan@gmail.com>
Copy link
Contributor Author

@eracah eracah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

things to change to make it work with "google" style

pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants