mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-27 20:42:10 +00:00
Add rule to enforce parentheses in a or b and c
(#9440)
Fixes #8721 ## Summary This implements the rule proposed in #8721, as RUF021. `and` always binds more tightly than `or` when chaining the two together. (This should definitely be autofixable, but I'm leaving that to a followup PR for now.) ## Test Plan `cargo test` / `cargo insta review`
This commit is contained in:
parent
84ab21f073
commit
86b1ae9383
8 changed files with 284 additions and 0 deletions
|
@ -923,6 +923,7 @@ pub fn code_to_rule(linter: Linter, code: &str) -> Option<(RuleGroup, Rule)> {
|
|||
(Ruff, "018") => (RuleGroup::Preview, rules::ruff::rules::AssignmentInAssert),
|
||||
(Ruff, "019") => (RuleGroup::Preview, rules::ruff::rules::UnnecessaryKeyCheck),
|
||||
(Ruff, "020") => (RuleGroup::Preview, rules::ruff::rules::NeverUnion),
|
||||
(Ruff, "021") => (RuleGroup::Preview, rules::ruff::rules::ParenthesizeChainedOperators),
|
||||
(Ruff, "100") => (RuleGroup::Stable, rules::ruff::rules::UnusedNOQA),
|
||||
(Ruff, "200") => (RuleGroup::Stable, rules::ruff::rules::InvalidPyprojectToml),
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue