From b2be81310fbbd6e9e725632c98e2c151e4a009be Mon Sep 17 00:00:00 2001 From: Michal Majer Date: Thu, 1 Sep 2022 17:02:43 +0200 Subject: [PATCH] Fix F832 --> F823 typo --- resources/test/src/{F832.py => F823.py} | 0 resources/test/src/pyproject.toml | 2 +- src/check_ast.rs | 2 +- src/checks.rs | 10 +++++----- src/linter.rs | 8 ++++---- src/pyproject.rs | 2 +- src/settings.rs | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) rename resources/test/src/{F832.py => F823.py} (100%) diff --git a/resources/test/src/F832.py b/resources/test/src/F823.py similarity index 100% rename from resources/test/src/F832.py rename to resources/test/src/F823.py diff --git a/resources/test/src/pyproject.toml b/resources/test/src/pyproject.toml index 21574e3fc2..8194ae3df3 100644 --- a/resources/test/src/pyproject.toml +++ b/resources/test/src/pyproject.toml @@ -11,7 +11,7 @@ select = [ "F706", "F821", "F831", - "F832", + "F823", "F841", "F901", ] diff --git a/src/check_ast.rs b/src/check_ast.rs index 76474811f1..9504bf369a 100644 --- a/src/check_ast.rs +++ b/src/check_ast.rs @@ -586,7 +586,7 @@ impl Checker<'_> { fn handle_node_store(&mut self, expr: &Expr) { if let ExprKind::Name { id, .. } = &expr.node { - if self.settings.select.contains(&CheckCode::F832) { + if self.settings.select.contains(&CheckCode::F823) { let current = self.scopes.last().expect("No current scope found."); if matches!(current.kind, ScopeKind::Function) && !current.values.contains_key(id) { for scope in self.scopes.iter().rev().skip(1) { diff --git a/src/checks.rs b/src/checks.rs index 0ef927f0fb..bbc140f154 100644 --- a/src/checks.rs +++ b/src/checks.rs @@ -16,7 +16,7 @@ pub enum CheckCode { F706, F821, F831, - F832, + F823, F841, F901, } @@ -35,7 +35,7 @@ impl FromStr for CheckCode { "F706" => Ok(CheckCode::F706), "F821" => Ok(CheckCode::F821), "F831" => Ok(CheckCode::F831), - "F832" => Ok(CheckCode::F832), + "F823" => Ok(CheckCode::F823), "F841" => Ok(CheckCode::F841), "F901" => Ok(CheckCode::F901), _ => Err(anyhow::anyhow!("Unknown check code: {s}")), @@ -55,7 +55,7 @@ impl CheckCode { CheckCode::F706 => "F706", CheckCode::F821 => "F821", CheckCode::F831 => "F831", - CheckCode::F832 => "F832", + CheckCode::F823 => "F823", CheckCode::F841 => "F841", CheckCode::F901 => "F901", } @@ -73,7 +73,7 @@ impl CheckCode { CheckCode::F706 => &LintSource::AST, CheckCode::F821 => &LintSource::AST, CheckCode::F831 => &LintSource::AST, - CheckCode::F832 => &LintSource::AST, + CheckCode::F823 => &LintSource::AST, CheckCode::F841 => &LintSource::AST, CheckCode::F901 => &LintSource::AST, } @@ -115,7 +115,7 @@ impl CheckKind { CheckKind::YieldOutsideFunction => &CheckCode::F704, CheckKind::ReturnOutsideFunction => &CheckCode::F706, CheckKind::UndefinedName(_) => &CheckCode::F821, - CheckKind::UndefinedLocal(_) => &CheckCode::F832, + CheckKind::UndefinedLocal(_) => &CheckCode::F823, CheckKind::UnusedVariable(_) => &CheckCode::F841, CheckKind::UnusedImport(_) => &CheckCode::F401, } diff --git a/src/linter.rs b/src/linter.rs index 5e7d8bf39b..f9513356e3 100644 --- a/src/linter.rs +++ b/src/linter.rs @@ -367,20 +367,20 @@ mod tests { } #[test] - fn f832() -> Result<()> { + fn f823() -> Result<()> { let actual = check_path( - &Path::new("./resources/test/src/F832.py"), + &Path::new("./resources/test/src/F823.py"), &settings::Settings { line_length: 88, exclude: vec![], - select: BTreeSet::from([CheckCode::F832]), + select: BTreeSet::from([CheckCode::F823]), }, &cache::Mode::None, )?; let expected = vec![Message { kind: CheckKind::UndefinedLocal("my_var".to_string()), location: Location::new(6, 5), - filename: "./resources/test/src/F832.py".to_string(), + filename: "./resources/test/src/F823.py".to_string(), }]; assert_eq!(actual.len(), expected.len()); for i in 0..actual.len() { diff --git a/src/pyproject.rs b/src/pyproject.rs index 2c48ef0d5d..a01617e429 100644 --- a/src/pyproject.rs +++ b/src/pyproject.rs @@ -247,7 +247,7 @@ other-attribute = 1 CheckCode::F706, CheckCode::F821, CheckCode::F831, - CheckCode::F832, + CheckCode::F823, CheckCode::F841, CheckCode::F901, ])), diff --git a/src/settings.rs b/src/settings.rs index 37ceac1da0..e603b6c16f 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -51,7 +51,7 @@ impl Settings { CheckCode::F634, CheckCode::F706, CheckCode::F831, - CheckCode::F832, + CheckCode::F823, CheckCode::F901, ]) }),