-
Notifications
You must be signed in to change notification settings - Fork 0
Ruff processors #32
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?
Ruff processors #32
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -6,7 +6,7 @@ | |||||||||||||||||
| from black.const import DEFAULT_LINE_LENGTH | ||||||||||||||||||
| from black.mode import TargetVersion | ||||||||||||||||||
|
|
||||||||||||||||||
| from .formatters import BlackFormatter | ||||||||||||||||||
| from .processors import BlackFormatter, RuffChecker, RuffFormatter | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| def run_black(argv: Sequence[str] | None = None) -> int: | ||||||||||||||||||
|
|
@@ -68,6 +68,7 @@ def run_black(argv: Sequence[str] | None = None) -> int: | |||||||||||||||||
|
|
||||||||||||||||||
| retv = 0 | ||||||||||||||||||
| for filename in args.filenames: | ||||||||||||||||||
| print(filename) | ||||||||||||||||||
| formatter = BlackFormatter(**formatter_kwargs) | ||||||||||||||||||
| retv |= formatter.format_file( | ||||||||||||||||||
| filename, | ||||||||||||||||||
|
|
@@ -79,10 +80,64 @@ def run_black(argv: Sequence[str] | None = None) -> int: | |||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| def run_check(argv: Sequence[str] | None = None) -> int: | ||||||||||||||||||
| ... | ||||||||||||||||||
| return 1 | ||||||||||||||||||
| parser = argparse.ArgumentParser() | ||||||||||||||||||
| parser.add_argument( | ||||||||||||||||||
| "-l", | ||||||||||||||||||
| "--line-length", | ||||||||||||||||||
| type=int, | ||||||||||||||||||
| default=DEFAULT_LINE_LENGTH, | ||||||||||||||||||
| ) | ||||||||||||||||||
| parser.add_argument( | ||||||||||||||||||
| "-S", | ||||||||||||||||||
| "--skip-string-normalization", | ||||||||||||||||||
| action="store_true", | ||||||||||||||||||
| ) | ||||||||||||||||||
| parser.add_argument("-E", "--skip-errors", action="store_true") | ||||||||||||||||||
| parser.add_argument("filenames", nargs="*") | ||||||||||||||||||
| args = parser.parse_args(argv) | ||||||||||||||||||
|
Comment on lines
+83
to
+97
|
||||||||||||||||||
|
|
||||||||||||||||||
| retv = 0 | ||||||||||||||||||
|
|
||||||||||||||||||
| for filename in args.filenames: | ||||||||||||||||||
| formatter = RuffChecker() | ||||||||||||||||||
| retv |= formatter.format_file( | ||||||||||||||||||
|
Comment on lines
+102
to
+103
|
||||||||||||||||||
| formatter = RuffChecker() | |
| retv |= formatter.format_file( | |
| checker = RuffChecker() | |
| retv |= checker.format_file( |
Copilot
AI
Jan 3, 2026
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.
These commented-out lines should either be removed if they're not needed, or uncommented and implemented if they are. Leaving commented code in the codebase reduces clarity about what the intended behavior should be.
Copilot
AI
Jan 3, 2026
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.
The argument parsing code in run_check and run_format is largely duplicated from run_black. Consider extracting this into a shared helper function to reduce code duplication and improve maintainability.
Copilot
AI
Jan 3, 2026
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.
The filenames list is initialized as empty but is never populated with args.filenames. This means the loop will never execute, and no files will be processed. You should use args.filenames directly in the loop, similar to how run_check and run_black are implemented.
| filenames = [] | |
| retv = 0 | |
| for filename in filenames: | |
| retv = 0 | |
| for filename in args.filenames: |
Copilot
AI
Jan 3, 2026
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.
These commented-out lines should either be removed if they're not needed, or uncommented and implemented if they are. Leaving commented code in the codebase reduces clarity about what the intended behavior should be.
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.
This debug print statement should be removed. It appears to have been added during development and will output filenames to stdout during normal operation, which could interfere with the tool's output and usage in automated environments.