mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-27 12:29:28 +00:00
[flake8-simplify
] Implement SIM911
(#9460)
## Summary Closes #9319, implements the [`SIM911` rule from `flake8-simplify`](https://github.com/MartinThoma/flake8-simplify/pull/183). #### Note I wasn't sure whether or not to include ```rs if checker.settings.preview.is_disabled() { return; } ``` at the beginning of the function with violation logic if the rule's already declared as part of `RuleGroup::Preview`. I've seen both variants, so I'd appreciate some feedback on that :)
This commit is contained in:
parent
f192c72596
commit
eb4ed2471b
6 changed files with 160 additions and 0 deletions
|
@ -472,6 +472,7 @@ pub fn code_to_rule(linter: Linter, code: &str) -> Option<(RuleGroup, Rule)> {
|
|||
(Flake8Simplify, "300") => (RuleGroup::Stable, rules::flake8_simplify::rules::YodaConditions),
|
||||
(Flake8Simplify, "401") => (RuleGroup::Stable, rules::flake8_simplify::rules::IfElseBlockInsteadOfDictGet),
|
||||
(Flake8Simplify, "910") => (RuleGroup::Stable, rules::flake8_simplify::rules::DictGetWithNoneDefault),
|
||||
(Flake8Simplify, "911") => (RuleGroup::Preview, rules::flake8_simplify::rules::ZipDictKeysAndValues),
|
||||
|
||||
// flake8-copyright
|
||||
#[allow(deprecated)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue