mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-27 04:19:18 +00:00
[ruff
] Add never-union
rule to detect redundant typing.NoReturn
and typing.Never
(#9217)
## Summary Adds a rule to detect unions that include `typing.NoReturn` or `typing.Never`. In such cases, the use of the bottom type is redundant. Closes https://github.com/astral-sh/ruff/issues/9113. ## Test Plan `cargo test`
This commit is contained in:
parent
a3e06e5a9d
commit
a9ceef5b5d
17 changed files with 283 additions and 73 deletions
|
@ -901,6 +901,7 @@ pub fn code_to_rule(linter: Linter, code: &str) -> Option<(RuleGroup, Rule)> {
|
|||
(Ruff, "017") => (RuleGroup::Nursery, rules::ruff::rules::QuadraticListSummation),
|
||||
(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, "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