-
Notifications
You must be signed in to change notification settings - Fork 3
Allow independent inclusion of the ruff linter and formatter #580
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?
Allow independent inclusion of the ruff linter and formatter #580
Conversation
CodSpeed Performance ReportMerging #580 will not alter performanceComparing Summary
|
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## main #580 +/- ##
==========================================
- Coverage 97.45% 97.44% -0.01%
==========================================
Files 102 102
Lines 4408 4431 +23
==========================================
+ Hits 4296 4318 +22
- Misses 112 113 +1 ☔ View full report in Codecov by Sentry. |
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.
Pull Request Overview
This PR allows users to enable the Ruff linter and formatter independently by introducing separate flags across the tool’s implementation and CLI interface.
- Introduces new linter and formatter parameters to RuffTool and updates its methods accordingly.
- Adjusts pre-commit repository definitions, Bitbucket step generation, and test expectations to match the new behavior.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
tests/usethis/_core/test_core_tool.py | Updates expected hook removal message order to match the new hook ID assignment. |
src/usethis/_tool/impl/ruff.py | Adds independent toggles for linter/formatter and adjusts hook definitions and steps. |
src/usethis/_interface/tool.py | Updates the CLI options for the ruff command to pass the new linter and formatter flags. |
src/usethis/_core/tool.py | Modifies use_ruff to accept and forward the new flags; updates rule config logic accordingly. |
Comments suppressed due to low confidence (1)
src/usethis/_core/tool.py:350
- Consider using the existing 'tool' instance (i.e. tool.get_selected_rules()) instead of creating a new RuffTool instance to ensure the correct linter/formatter configuration is used.
or not RuffTool().get_selected_rules()
|
||
if not linter and not formatter: | ||
msg = f"{self.name} must be used as either a linter, a formatter, or both." | ||
raise NotImplementedError(msg) |
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.
Consider raising a ValueError instead of NotImplementedError when both linter and formatter are false, as this reflects an invalid argument state.
raise NotImplementedError(msg) | |
raise ValueError(msg) |
Copilot uses AI. Check for mistakes.
I think this needs some more thought. The attributes Bearing in mind that the user might be using the Ruff formatter even if they haven't used |
No description provided.