mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 13:25:17 +00:00
[ruff
] Implement redirected-noqa
(RUF101
) (#11052)
## Summary Based on discussion in #10850. As it stands today `RUF100` will attempt to replace code redirects with their target codes even though this is not the "goal" of `RUF100`. This behavior is confusing and inconsistent, since code redirects which don't otherwise violate `RUF100` will not be updated. The behavior is also undocumented. Additionally, users who want to use `RUF100` but do not want to update redirects have no way to opt out. This PR explicitly detects redirects with a new rule `RUF101` and patches `RUF100` to keep original codes in fixes and reporting. ## Test Plan Added fixture.
This commit is contained in:
parent
632965d0fa
commit
5994414739
27 changed files with 411 additions and 52 deletions
|
@ -969,6 +969,7 @@ pub fn code_to_rule(linter: Linter, code: &str) -> Option<(RuleGroup, Rule)> {
|
|||
(Ruff, "028") => (RuleGroup::Preview, rules::ruff::rules::InvalidFormatterSuppressionComment),
|
||||
(Ruff, "029") => (RuleGroup::Preview, rules::ruff::rules::UnusedAsync),
|
||||
(Ruff, "100") => (RuleGroup::Stable, rules::ruff::rules::UnusedNOQA),
|
||||
(Ruff, "101") => (RuleGroup::Preview, rules::ruff::rules::RedirectedNOQA),
|
||||
(Ruff, "200") => (RuleGroup::Stable, rules::ruff::rules::InvalidPyprojectToml),
|
||||
#[cfg(feature = "test-rules")]
|
||||
(Ruff, "900") => (RuleGroup::Stable, rules::ruff::rules::StableTestRule),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue