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

Use Ruff for Python static analysis and formatting #1784

Merged
merged 25 commits into from
Jan 22, 2024
Merged

Use Ruff for Python static analysis and formatting #1784

merged 25 commits into from
Jan 22, 2024

Conversation

brianhelba
Copy link
Collaborator

@brianhelba brianhelba commented Dec 14, 2023

This replaces the entire Flake8 / isort / Black toolchain, while adding many new checks and improving performance.


These must be merged first, for tests here to pass:

pyproject.toml Outdated Show resolved Hide resolved
]
"**/migrations/**" = [
"N806", # Variable in function should be lowercase
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Could be removed after upstream fix?

"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
]
"**/management/commands/**" = [
"INP001", # File is part of an implicit namespace package
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe require this to be importable, so commands can be overridden.


[tool.ruff.format]
quote-style = "single"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@@ -14,7 +14,7 @@ class PublishConfig(AppConfig):
verbose_name = 'DANDI: Publish'

@staticmethod
def _get_sentry_performance_sample_rate(*args, **kwargs) -> float:
def _get_sentry_performance_sample_rate(*args, **kwargs) -> float: # noqa: ARG004
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe ignore overall.


# Try to fix upstream
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
]
"PTH119", # TODO: re-enable this when it's fixed
]

@brianhelba we discussed this yesterday, and decided that a somewhat significant change like #1782 would be better to decouple from the Ruff work. Do you have any objections to just temporarily ignoring this rule so we can merge this PR?

Copy link
Member

Choose a reason for hiding this comment

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

Added in 7122589

@mvandenburgh mvandenburgh marked this pull request as ready for review January 22, 2024 17:52
@mvandenburgh mvandenburgh merged commit bee9b58 into master Jan 22, 2024
10 checks passed
@mvandenburgh mvandenburgh deleted the ruff branch January 22, 2024 17:53
@dandibot
Copy link
Member

dandibot commented Feb 6, 2024

🚀 PR was released in v0.3.73 🚀

@dandibot dandibot added the released This issue/pull request has been released. label Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants