mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-26 20:10:09 +00:00
Rename PLE0206 to PLR0206 (#1006)
This commit is contained in:
parent
31a3314ebd
commit
115e85b47d
6 changed files with 25 additions and 21 deletions
|
@ -751,8 +751,8 @@ For more, see [Pylint](https://pypi.org/project/pylint/2.15.7/) on PyPI.
|
||||||
|
|
||||||
| Code | Name | Message | Fix |
|
| Code | Name | Message | Fix |
|
||||||
| ---- | ---- | ------- | --- |
|
| ---- | ---- | ------- | --- |
|
||||||
| PLE0206 | PropertyWithParameters | Cannot have defined parameters for properties | |
|
|
||||||
| PLE1142 | AwaitOutsideAsync | `await` should be used within an async function | |
|
| PLE1142 | AwaitOutsideAsync | `await` should be used within an async function | |
|
||||||
|
| PLR0206 | PropertyWithParameters | Cannot have defined parameters for properties | |
|
||||||
|
|
||||||
### Ruff-specific rules
|
### Ruff-specific rules
|
||||||
|
|
||||||
|
|
|
@ -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)
|
pylint::plugins::property_with_parameters(self, stmt, decorator_list, args)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ pub enum CheckCode {
|
||||||
F841,
|
F841,
|
||||||
F901,
|
F901,
|
||||||
// pylint errors
|
// pylint errors
|
||||||
PLE0206,
|
PLR0206,
|
||||||
PLE1142,
|
PLE1142,
|
||||||
// flake8-builtins
|
// flake8-builtins
|
||||||
A001,
|
A001,
|
||||||
|
@ -827,7 +827,7 @@ impl CheckCode {
|
||||||
CheckCode::F841 => CheckKind::UnusedVariable("...".to_string()),
|
CheckCode::F841 => CheckKind::UnusedVariable("...".to_string()),
|
||||||
CheckCode::F901 => CheckKind::RaiseNotImplemented,
|
CheckCode::F901 => CheckKind::RaiseNotImplemented,
|
||||||
// pylint errors
|
// pylint errors
|
||||||
CheckCode::PLE0206 => CheckKind::PropertyWithParameters,
|
CheckCode::PLR0206 => CheckKind::PropertyWithParameters,
|
||||||
CheckCode::PLE1142 => CheckKind::AwaitOutsideAsync,
|
CheckCode::PLE1142 => CheckKind::AwaitOutsideAsync,
|
||||||
// flake8-builtins
|
// flake8-builtins
|
||||||
CheckCode::A001 => CheckKind::BuiltinVariableShadowing("...".to_string()),
|
CheckCode::A001 => CheckKind::BuiltinVariableShadowing("...".to_string()),
|
||||||
|
@ -1240,7 +1240,7 @@ impl CheckCode {
|
||||||
CheckCode::N817 => CheckCategory::PEP8Naming,
|
CheckCode::N817 => CheckCategory::PEP8Naming,
|
||||||
CheckCode::N818 => CheckCategory::PEP8Naming,
|
CheckCode::N818 => CheckCategory::PEP8Naming,
|
||||||
CheckCode::PGH001 => CheckCategory::PygrepHooks,
|
CheckCode::PGH001 => CheckCategory::PygrepHooks,
|
||||||
CheckCode::PLE0206 => CheckCategory::Pylint,
|
CheckCode::PLR0206 => CheckCategory::Pylint,
|
||||||
CheckCode::PLE1142 => CheckCategory::Pylint,
|
CheckCode::PLE1142 => CheckCategory::Pylint,
|
||||||
CheckCode::Q000 => CheckCategory::Flake8Quotes,
|
CheckCode::Q000 => CheckCategory::Flake8Quotes,
|
||||||
CheckCode::Q001 => CheckCategory::Flake8Quotes,
|
CheckCode::Q001 => CheckCategory::Flake8Quotes,
|
||||||
|
@ -1354,7 +1354,7 @@ impl CheckKind {
|
||||||
CheckKind::NoNewLineAtEndOfFile => &CheckCode::W292,
|
CheckKind::NoNewLineAtEndOfFile => &CheckCode::W292,
|
||||||
CheckKind::InvalidEscapeSequence(_) => &CheckCode::W605,
|
CheckKind::InvalidEscapeSequence(_) => &CheckCode::W605,
|
||||||
// pylint errors
|
// pylint errors
|
||||||
CheckKind::PropertyWithParameters => &CheckCode::PLE0206,
|
CheckKind::PropertyWithParameters => &CheckCode::PLR0206,
|
||||||
CheckKind::AwaitOutsideAsync => &CheckCode::PLE1142,
|
CheckKind::AwaitOutsideAsync => &CheckCode::PLE1142,
|
||||||
// flake8-builtins
|
// flake8-builtins
|
||||||
CheckKind::BuiltinVariableShadowing(_) => &CheckCode::A001,
|
CheckKind::BuiltinVariableShadowing(_) => &CheckCode::A001,
|
||||||
|
|
|
@ -283,14 +283,15 @@ pub enum CheckCodePrefix {
|
||||||
PGH00,
|
PGH00,
|
||||||
PGH001,
|
PGH001,
|
||||||
PLE,
|
PLE,
|
||||||
PLE0,
|
|
||||||
PLE02,
|
|
||||||
PLE020,
|
|
||||||
PLE0206,
|
|
||||||
PLE1,
|
PLE1,
|
||||||
PLE11,
|
PLE11,
|
||||||
PLE114,
|
PLE114,
|
||||||
PLE1142,
|
PLE1142,
|
||||||
|
PLR,
|
||||||
|
PLR0,
|
||||||
|
PLR02,
|
||||||
|
PLR020,
|
||||||
|
PLR0206,
|
||||||
Q,
|
Q,
|
||||||
Q0,
|
Q0,
|
||||||
Q00,
|
Q00,
|
||||||
|
@ -1160,15 +1161,16 @@ impl CheckCodePrefix {
|
||||||
CheckCodePrefix::PGH0 => vec![CheckCode::PGH001],
|
CheckCodePrefix::PGH0 => vec![CheckCode::PGH001],
|
||||||
CheckCodePrefix::PGH00 => vec![CheckCode::PGH001],
|
CheckCodePrefix::PGH00 => vec![CheckCode::PGH001],
|
||||||
CheckCodePrefix::PGH001 => vec![CheckCode::PGH001],
|
CheckCodePrefix::PGH001 => vec![CheckCode::PGH001],
|
||||||
CheckCodePrefix::PLE => vec![CheckCode::PLE0206, CheckCode::PLE1142],
|
CheckCodePrefix::PLE => vec![CheckCode::PLE1142],
|
||||||
CheckCodePrefix::PLE0 => vec![CheckCode::PLE0206],
|
|
||||||
CheckCodePrefix::PLE02 => vec![CheckCode::PLE0206],
|
|
||||||
CheckCodePrefix::PLE020 => vec![CheckCode::PLE0206],
|
|
||||||
CheckCodePrefix::PLE0206 => vec![CheckCode::PLE0206],
|
|
||||||
CheckCodePrefix::PLE1 => vec![CheckCode::PLE1142],
|
CheckCodePrefix::PLE1 => vec![CheckCode::PLE1142],
|
||||||
CheckCodePrefix::PLE11 => vec![CheckCode::PLE1142],
|
CheckCodePrefix::PLE11 => vec![CheckCode::PLE1142],
|
||||||
CheckCodePrefix::PLE114 => vec![CheckCode::PLE1142],
|
CheckCodePrefix::PLE114 => vec![CheckCode::PLE1142],
|
||||||
CheckCodePrefix::PLE1142 => 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![
|
CheckCodePrefix::Q => vec![
|
||||||
CheckCode::Q000,
|
CheckCode::Q000,
|
||||||
CheckCode::Q001,
|
CheckCode::Q001,
|
||||||
|
@ -1636,14 +1638,15 @@ impl CheckCodePrefix {
|
||||||
CheckCodePrefix::PGH00 => SuffixLength::Two,
|
CheckCodePrefix::PGH00 => SuffixLength::Two,
|
||||||
CheckCodePrefix::PGH001 => SuffixLength::Three,
|
CheckCodePrefix::PGH001 => SuffixLength::Three,
|
||||||
CheckCodePrefix::PLE => SuffixLength::Zero,
|
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::PLE1 => SuffixLength::One,
|
||||||
CheckCodePrefix::PLE11 => SuffixLength::Two,
|
CheckCodePrefix::PLE11 => SuffixLength::Two,
|
||||||
CheckCodePrefix::PLE114 => SuffixLength::Three,
|
CheckCodePrefix::PLE114 => SuffixLength::Three,
|
||||||
CheckCodePrefix::PLE1142 => SuffixLength::Four,
|
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::Q => SuffixLength::Zero,
|
||||||
CheckCodePrefix::Q0 => SuffixLength::One,
|
CheckCodePrefix::Q0 => SuffixLength::One,
|
||||||
CheckCodePrefix::Q00 => SuffixLength::Two,
|
CheckCodePrefix::Q00 => SuffixLength::Two,
|
||||||
|
@ -1739,6 +1742,7 @@ pub const CATEGORIES: &[CheckCodePrefix] = &[
|
||||||
CheckCodePrefix::N,
|
CheckCodePrefix::N,
|
||||||
CheckCodePrefix::PGH,
|
CheckCodePrefix::PGH,
|
||||||
CheckCodePrefix::PLE,
|
CheckCodePrefix::PLE,
|
||||||
|
CheckCodePrefix::PLR,
|
||||||
CheckCodePrefix::Q,
|
CheckCodePrefix::Q,
|
||||||
CheckCodePrefix::RUF,
|
CheckCodePrefix::RUF,
|
||||||
CheckCodePrefix::S,
|
CheckCodePrefix::S,
|
||||||
|
|
|
@ -11,7 +11,7 @@ mod tests {
|
||||||
use crate::linter::test_path;
|
use crate::linter::test_path;
|
||||||
use crate::Settings;
|
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")]
|
#[test_case(CheckCode::PLE1142, Path::new("await_outside_async.py"); "PLE1142")]
|
||||||
fn checks(check_code: CheckCode, path: &Path) -> Result<()> {
|
fn checks(check_code: CheckCode, path: &Path) -> Result<()> {
|
||||||
let snapshot = format!("{}", path.to_string_lossy());
|
let snapshot = format!("{}", path.to_string_lossy());
|
||||||
|
|
|
@ -5,7 +5,7 @@ use crate::check_ast::Checker;
|
||||||
use crate::checks::CheckKind;
|
use crate::checks::CheckKind;
|
||||||
use crate::Check;
|
use crate::Check;
|
||||||
|
|
||||||
/// PLE0206
|
/// PLR0206
|
||||||
pub fn property_with_parameters(
|
pub fn property_with_parameters(
|
||||||
checker: &mut Checker,
|
checker: &mut Checker,
|
||||||
stmt: &Stmt,
|
stmt: &Stmt,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue