-
Notifications
You must be signed in to change notification settings - Fork 845
Update Ruff, replace pycln and simplify configs #2676
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: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| target-version = "py38" # Target the oldest supported version in editors and default CLI | ||
| target-version = "py38" # Target the oldest supported version | ||
| # This file is not UTF-8 | ||
| extend-exclude = ["Pythonwin/pywin/test/_dbgscript.py"] | ||
|
|
||
|
|
@@ -9,6 +9,7 @@ line-ending = "cr-lf" | |
| select = [ | ||
| "B028", # no-explicit-stacklevel | ||
| "C4", # flake8-comprehensions | ||
| "F401", # unused-import | ||
| "F811", # redefined-while-unused | ||
| "I", # isort | ||
| "PLC", # Pylint Convention | ||
|
|
@@ -20,42 +21,45 @@ select = [ | |
| # String formatting, concatenating, interpolation, ... | ||
| "FLY", # static-join-to-f-string | ||
| "G", # flake8-logging-format | ||
| # Note, we still want to allow multiline ISC | ||
| "UP025", # Remove unicode literals from strings | ||
| "UP030", # Use implicit references for positional format fields | ||
| # TODO: Still lots of manual fixes needed | ||
| # "UP031", # Use format specifiers instead of percent format | ||
| # "UP032", # Use f-string instead of format call | ||
|
|
||
| # Ensure modern type annotation syntax and best practices | ||
| # Not including those covered by type-checkers or exclusive to Python 3.11+ | ||
| "FA", # flake8-future-annotations | ||
| "F404", # late-future-import | ||
| "PYI", # flake8-pyi | ||
| "UP006", # non-pep585-annotation | ||
| "UP007", # non-pep604-annotation | ||
| "UP010", # unnecessary-future-import | ||
| "UP035", # deprecated-import | ||
| "UP037", # quoted-annotation | ||
| "UP043", # unnecessary-default-type-args | ||
|
|
||
| # Code modernization (strings, annotations, conditions, ...) | ||
| "UP", # pyupgrade | ||
|
|
||
| # Helps prevent circular imports and other unneeded imports | ||
| "TC", # flake8-type-checking | ||
| ] | ||
|
|
||
| extend-ignore = [ | ||
| # TODO: Consider passing exception around to ensure methods are only ever used within exception handlers | ||
| "PLE0704", # misplaced-bare-raise | ||
|
|
||
| # We prefer explicit open mode parameter | ||
| "UP015", # redundant-open-modes | ||
| # No such concerns for stdlib | ||
| "TC003", # typing-only-standard-library-import | ||
| # Lots of lazy or side-effect imports | ||
| "PLC0415", # import-outside-top-level | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added ignore for Ruff 0.12 |
||
| # TODO: Consider passing exception around to ensure methods are only ever used within exception handlers | ||
| "PLE0704", # misplaced-bare-raise | ||
| # TODO: Still lots of manual fixes needed | ||
| "UP031", # Use format specifiers instead of percent format | ||
| "UP032", # Use f-string instead of format call | ||
| ] | ||
|
|
||
| [lint.per-file-ignores] | ||
| # Explicit re-exports is fine in __init__.py, still a code smell elsewhere. | ||
| "__init__.py" = ["PLC0414"] | ||
| # TODO: Make adodbapi changes in their own PRs | ||
| "adodbapi/*" = ["C4", "YTT301", "UP031", "UP032"] | ||
|
Comment on lines
-54
to
-58
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| [lint.pyflakes] | ||
| allowed-unused-imports = [ | ||
| # Modules with known side-effects | ||
| "coloreditor", # Adds doc template | ||
| "IDLEenvironment", # Injects fast_readline into the IDLE auto-indent extension | ||
| "pythoncom", # pythoncomXX.dll loader | ||
| "pywintypes", # pywintypesXX.dll loader | ||
| "win32com", # Sets pythoncom.frozen and adds modules to path based on the registry | ||
| "win32traceutil", # Redirects output to win32trace remote collector | ||
| "win32ui", # Must always be imported before dde | ||
| # Note: com/win32com/client/gencache.py does read files on import, but only to fill in it's own dicts from cache | ||
| ] | ||
|
|
||
| [lint.isort] | ||
| combine-as-imports = true | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,4 +5,4 @@ | |
| around _winxptheme. | ||
| """ | ||
|
|
||
| from _winxptheme import * # nopycln: import | ||
| from _winxptheme import * | ||
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.
astral-sh/ruff#15705
This was also already affecting pycln