mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-27 12:29:28 +00:00
[pylint
] Implement import-private-name
(C2701
) (#5920)
## Summary Implements [`import-private-name` (`C2701`)](https://pylint.pycqa.org/en/latest/user_guide/messages/convention/import-private-name.html) as `import-private-name` (`PLC2701`). Includes documentation. Related to #970. Closes https://github.com/astral-sh/ruff/issues/9138. ### PEP 420 namespace package limitation `checker.module_path` doesn't seem to support automatic detection of namespace packages (PEP 420). This leads to 'false' positives (Pylint allows both). Currently, for this to work like Pylint, users would have to [manually input known namespace packages](https://beta.ruff.rs/docs/settings/#namespace-packages). ## Test Plan `cargo test`
This commit is contained in:
parent
7ef7e0ddb6
commit
2b605527bd
16 changed files with 268 additions and 0 deletions
|
@ -217,6 +217,7 @@ pub fn code_to_rule(linter: Linter, code: &str) -> Option<(RuleGroup, Rule)> {
|
|||
(Pylint, "C2801") => (RuleGroup::Preview, rules::pylint::rules::UnnecessaryDunderCall),
|
||||
#[allow(deprecated)]
|
||||
(Pylint, "C1901") => (RuleGroup::Nursery, rules::pylint::rules::CompareToEmptyString),
|
||||
(Pylint, "C2701") => (RuleGroup::Preview, rules::pylint::rules::ImportPrivateName),
|
||||
(Pylint, "C3002") => (RuleGroup::Stable, rules::pylint::rules::UnnecessaryDirectLambdaCall),
|
||||
(Pylint, "E0100") => (RuleGroup::Stable, rules::pylint::rules::YieldInInit),
|
||||
(Pylint, "E0101") => (RuleGroup::Stable, rules::pylint::rules::ReturnInInit),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue