[ruff] Implement redirected-noqa (RUF101)#11052
Merged
charliermarsh merged 10 commits intoastral-sh:mainfrom Apr 27, 2024
Merged
[ruff] Implement redirected-noqa (RUF101)#11052charliermarsh merged 10 commits intoastral-sh:mainfrom
ruff] Implement redirected-noqa (RUF101)#11052charliermarsh merged 10 commits intoastral-sh:mainfrom
Conversation
Contributor
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| RUF100 | 2 | 1 | 1 | 0 | 0 |
Linter (preview)
ℹ️ ecosystem check detected linter changes. (+3 -1 violations, +0 -0 fixes in 2 projects; 42 projects unchanged)
DisnakeDev/disnake (+1 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
+ disnake/utils.py:1161:56: RUF101 [*] `PGH001` is a redirect to `S307`
RasaHQ/rasa (+2 -1 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
- tests/graph_components/validators/test_default_recipe_validator.py:815:64: RUF100 [*] Unused `noqa` directive (non-enabled: `B035`) + tests/graph_components/validators/test_default_recipe_validator.py:815:64: RUF100 [*] Unused `noqa` directive (non-enabled: `RUF011`) + tests/graph_components/validators/test_default_recipe_validator.py:815:72: RUF101 [*] `RUF011` is a redirect to `B035`
Changes by rule (2 rules affected)
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| RUF101 | 2 | 2 | 0 | 0 | 0 |
| RUF100 | 2 | 1 | 1 | 0 | 0 |
Co-authored-by: Micha Reiser <micha@reiser.io>
Co-authored-by: Micha Reiser <micha@reiser.io>
Member
|
Sorry, I know this is blocked on my review. |
Contributor
Author
|
Thanks for taking the time 😄 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Based on discussion in #10850.
As it stands today
RUF100will attempt to replace code redirects with their target codes even though this is not the "goal" ofRUF100. This behavior is confusing and inconsistent, since code redirects which don't otherwise violateRUF100will not be updated. The behavior is also undocumented. Additionally, users who want to useRUF100but do not want to update redirects have no way to opt out.This PR explicitly detects redirects with a new rule
RUF101and patchesRUF100to keep original codes in fixes and reporting.Test Plan
Added fixture.