diff --git a/README.md b/README.md index b1e16609e5..15144c8455 100644 --- a/README.md +++ b/README.md @@ -751,8 +751,8 @@ For more, see [Pylint](https://pypi.org/project/pylint/2.15.7/) on PyPI. | Code | Name | Message | Fix | | ---- | ---- | ------- | --- | -| PLE0206 | PropertyWithParameters | Cannot have defined parameters for properties | | | PLE1142 | AwaitOutsideAsync | `await` should be used within an async function | | +| PLR0206 | PropertyWithParameters | Cannot have defined parameters for properties | | ### Ruff-specific rules diff --git a/src/check_ast.rs b/src/check_ast.rs index a367d73d4a..8dc9f6b229 100644 --- a/src/check_ast.rs +++ b/src/check_ast.rs @@ -441,7 +441,7 @@ where ); } - if self.settings.enabled.contains(&CheckCode::PLE0206) { + if self.settings.enabled.contains(&CheckCode::PLR0206) { pylint::plugins::property_with_parameters(self, stmt, decorator_list, args) } diff --git a/src/checks.rs b/src/checks.rs index 1c3ebb055d..ea636ad423 100644 --- a/src/checks.rs +++ b/src/checks.rs @@ -91,7 +91,7 @@ pub enum CheckCode { F841, F901, // pylint errors - PLE0206, + PLR0206, PLE1142, // flake8-builtins A001, @@ -827,7 +827,7 @@ impl CheckCode { CheckCode::F841 => CheckKind::UnusedVariable("...".to_string()), CheckCode::F901 => CheckKind::RaiseNotImplemented, // pylint errors - CheckCode::PLE0206 => CheckKind::PropertyWithParameters, + CheckCode::PLR0206 => CheckKind::PropertyWithParameters, CheckCode::PLE1142 => CheckKind::AwaitOutsideAsync, // flake8-builtins CheckCode::A001 => CheckKind::BuiltinVariableShadowing("...".to_string()), @@ -1240,7 +1240,7 @@ impl CheckCode { CheckCode::N817 => CheckCategory::PEP8Naming, CheckCode::N818 => CheckCategory::PEP8Naming, CheckCode::PGH001 => CheckCategory::PygrepHooks, - CheckCode::PLE0206 => CheckCategory::Pylint, + CheckCode::PLR0206 => CheckCategory::Pylint, CheckCode::PLE1142 => CheckCategory::Pylint, CheckCode::Q000 => CheckCategory::Flake8Quotes, CheckCode::Q001 => CheckCategory::Flake8Quotes, @@ -1354,7 +1354,7 @@ impl CheckKind { CheckKind::NoNewLineAtEndOfFile => &CheckCode::W292, CheckKind::InvalidEscapeSequence(_) => &CheckCode::W605, // pylint errors - CheckKind::PropertyWithParameters => &CheckCode::PLE0206, + CheckKind::PropertyWithParameters => &CheckCode::PLR0206, CheckKind::AwaitOutsideAsync => &CheckCode::PLE1142, // flake8-builtins CheckKind::BuiltinVariableShadowing(_) => &CheckCode::A001, diff --git a/src/checks_gen.rs b/src/checks_gen.rs index b8c709353c..004505a040 100644 --- a/src/checks_gen.rs +++ b/src/checks_gen.rs @@ -283,14 +283,15 @@ pub enum CheckCodePrefix { PGH00, PGH001, PLE, - PLE0, - PLE02, - PLE020, - PLE0206, PLE1, PLE11, PLE114, PLE1142, + PLR, + PLR0, + PLR02, + PLR020, + PLR0206, Q, Q0, Q00, @@ -1160,15 +1161,16 @@ impl CheckCodePrefix { CheckCodePrefix::PGH0 => vec![CheckCode::PGH001], CheckCodePrefix::PGH00 => vec![CheckCode::PGH001], CheckCodePrefix::PGH001 => vec![CheckCode::PGH001], - CheckCodePrefix::PLE => vec![CheckCode::PLE0206, CheckCode::PLE1142], - CheckCodePrefix::PLE0 => vec![CheckCode::PLE0206], - CheckCodePrefix::PLE02 => vec![CheckCode::PLE0206], - CheckCodePrefix::PLE020 => vec![CheckCode::PLE0206], - CheckCodePrefix::PLE0206 => vec![CheckCode::PLE0206], + CheckCodePrefix::PLE => vec![CheckCode::PLE1142], CheckCodePrefix::PLE1 => vec![CheckCode::PLE1142], CheckCodePrefix::PLE11 => vec![CheckCode::PLE1142], CheckCodePrefix::PLE114 => vec![CheckCode::PLE1142], CheckCodePrefix::PLE1142 => vec![CheckCode::PLE1142], + CheckCodePrefix::PLR => vec![CheckCode::PLR0206], + CheckCodePrefix::PLR0 => vec![CheckCode::PLR0206], + CheckCodePrefix::PLR02 => vec![CheckCode::PLR0206], + CheckCodePrefix::PLR020 => vec![CheckCode::PLR0206], + CheckCodePrefix::PLR0206 => vec![CheckCode::PLR0206], CheckCodePrefix::Q => vec![ CheckCode::Q000, CheckCode::Q001, @@ -1636,14 +1638,15 @@ impl CheckCodePrefix { CheckCodePrefix::PGH00 => SuffixLength::Two, CheckCodePrefix::PGH001 => SuffixLength::Three, CheckCodePrefix::PLE => SuffixLength::Zero, - CheckCodePrefix::PLE0 => SuffixLength::One, - CheckCodePrefix::PLE02 => SuffixLength::Two, - CheckCodePrefix::PLE020 => SuffixLength::Three, - CheckCodePrefix::PLE0206 => SuffixLength::Four, CheckCodePrefix::PLE1 => SuffixLength::One, CheckCodePrefix::PLE11 => SuffixLength::Two, CheckCodePrefix::PLE114 => SuffixLength::Three, CheckCodePrefix::PLE1142 => SuffixLength::Four, + CheckCodePrefix::PLR => SuffixLength::Zero, + CheckCodePrefix::PLR0 => SuffixLength::One, + CheckCodePrefix::PLR02 => SuffixLength::Two, + CheckCodePrefix::PLR020 => SuffixLength::Three, + CheckCodePrefix::PLR0206 => SuffixLength::Four, CheckCodePrefix::Q => SuffixLength::Zero, CheckCodePrefix::Q0 => SuffixLength::One, CheckCodePrefix::Q00 => SuffixLength::Two, @@ -1739,6 +1742,7 @@ pub const CATEGORIES: &[CheckCodePrefix] = &[ CheckCodePrefix::N, CheckCodePrefix::PGH, CheckCodePrefix::PLE, + CheckCodePrefix::PLR, CheckCodePrefix::Q, CheckCodePrefix::RUF, CheckCodePrefix::S, diff --git a/src/pylint/mod.rs b/src/pylint/mod.rs index 466da29109..9f2cb1bf03 100644 --- a/src/pylint/mod.rs +++ b/src/pylint/mod.rs @@ -11,7 +11,7 @@ mod tests { use crate::linter::test_path; use crate::Settings; - #[test_case(CheckCode::PLE0206, Path::new("property_with_parameters.py"); "PLE0206")] + #[test_case(CheckCode::PLR0206, Path::new("property_with_parameters.py"); "PLR0206")] #[test_case(CheckCode::PLE1142, Path::new("await_outside_async.py"); "PLE1142")] fn checks(check_code: CheckCode, path: &Path) -> Result<()> { let snapshot = format!("{}", path.to_string_lossy()); diff --git a/src/pylint/plugins.rs b/src/pylint/plugins.rs index bececc1372..24d706a318 100644 --- a/src/pylint/plugins.rs +++ b/src/pylint/plugins.rs @@ -5,7 +5,7 @@ use crate::check_ast::Checker; use crate::checks::CheckKind; use crate::Check; -/// PLE0206 +/// PLR0206 pub fn property_with_parameters( checker: &mut Checker, stmt: &Stmt,