Fix F832 --> F823 typo

This commit is contained in:
Michal Majer 2022-09-01 17:02:43 +02:00
parent ba27e50164
commit b2be81310f
7 changed files with 13 additions and 13 deletions

View File

@ -11,7 +11,7 @@ select = [
"F706", "F706",
"F821", "F821",
"F831", "F831",
"F832", "F823",
"F841", "F841",
"F901", "F901",
] ]

View File

@ -586,7 +586,7 @@ impl Checker<'_> {
fn handle_node_store(&mut self, expr: &Expr) { fn handle_node_store(&mut self, expr: &Expr) {
if let ExprKind::Name { id, .. } = &expr.node { 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."); let current = self.scopes.last().expect("No current scope found.");
if matches!(current.kind, ScopeKind::Function) && !current.values.contains_key(id) { if matches!(current.kind, ScopeKind::Function) && !current.values.contains_key(id) {
for scope in self.scopes.iter().rev().skip(1) { for scope in self.scopes.iter().rev().skip(1) {

View File

@ -16,7 +16,7 @@ pub enum CheckCode {
F706, F706,
F821, F821,
F831, F831,
F832, F823,
F841, F841,
F901, F901,
} }
@ -35,7 +35,7 @@ impl FromStr for CheckCode {
"F706" => Ok(CheckCode::F706), "F706" => Ok(CheckCode::F706),
"F821" => Ok(CheckCode::F821), "F821" => Ok(CheckCode::F821),
"F831" => Ok(CheckCode::F831), "F831" => Ok(CheckCode::F831),
"F832" => Ok(CheckCode::F832), "F823" => Ok(CheckCode::F823),
"F841" => Ok(CheckCode::F841), "F841" => Ok(CheckCode::F841),
"F901" => Ok(CheckCode::F901), "F901" => Ok(CheckCode::F901),
_ => Err(anyhow::anyhow!("Unknown check code: {s}")), _ => Err(anyhow::anyhow!("Unknown check code: {s}")),
@ -55,7 +55,7 @@ impl CheckCode {
CheckCode::F706 => "F706", CheckCode::F706 => "F706",
CheckCode::F821 => "F821", CheckCode::F821 => "F821",
CheckCode::F831 => "F831", CheckCode::F831 => "F831",
CheckCode::F832 => "F832", CheckCode::F823 => "F823",
CheckCode::F841 => "F841", CheckCode::F841 => "F841",
CheckCode::F901 => "F901", CheckCode::F901 => "F901",
} }
@ -73,7 +73,7 @@ impl CheckCode {
CheckCode::F706 => &LintSource::AST, CheckCode::F706 => &LintSource::AST,
CheckCode::F821 => &LintSource::AST, CheckCode::F821 => &LintSource::AST,
CheckCode::F831 => &LintSource::AST, CheckCode::F831 => &LintSource::AST,
CheckCode::F832 => &LintSource::AST, CheckCode::F823 => &LintSource::AST,
CheckCode::F841 => &LintSource::AST, CheckCode::F841 => &LintSource::AST,
CheckCode::F901 => &LintSource::AST, CheckCode::F901 => &LintSource::AST,
} }
@ -115,7 +115,7 @@ impl CheckKind {
CheckKind::YieldOutsideFunction => &CheckCode::F704, CheckKind::YieldOutsideFunction => &CheckCode::F704,
CheckKind::ReturnOutsideFunction => &CheckCode::F706, CheckKind::ReturnOutsideFunction => &CheckCode::F706,
CheckKind::UndefinedName(_) => &CheckCode::F821, CheckKind::UndefinedName(_) => &CheckCode::F821,
CheckKind::UndefinedLocal(_) => &CheckCode::F832, CheckKind::UndefinedLocal(_) => &CheckCode::F823,
CheckKind::UnusedVariable(_) => &CheckCode::F841, CheckKind::UnusedVariable(_) => &CheckCode::F841,
CheckKind::UnusedImport(_) => &CheckCode::F401, CheckKind::UnusedImport(_) => &CheckCode::F401,
} }

View File

@ -367,20 +367,20 @@ mod tests {
} }
#[test] #[test]
fn f832() -> Result<()> { fn f823() -> Result<()> {
let actual = check_path( let actual = check_path(
&Path::new("./resources/test/src/F832.py"), &Path::new("./resources/test/src/F823.py"),
&settings::Settings { &settings::Settings {
line_length: 88, line_length: 88,
exclude: vec![], exclude: vec![],
select: BTreeSet::from([CheckCode::F832]), select: BTreeSet::from([CheckCode::F823]),
}, },
&cache::Mode::None, &cache::Mode::None,
)?; )?;
let expected = vec![Message { let expected = vec![Message {
kind: CheckKind::UndefinedLocal("my_var".to_string()), kind: CheckKind::UndefinedLocal("my_var".to_string()),
location: Location::new(6, 5), 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()); assert_eq!(actual.len(), expected.len());
for i in 0..actual.len() { for i in 0..actual.len() {

View File

@ -247,7 +247,7 @@ other-attribute = 1
CheckCode::F706, CheckCode::F706,
CheckCode::F821, CheckCode::F821,
CheckCode::F831, CheckCode::F831,
CheckCode::F832, CheckCode::F823,
CheckCode::F841, CheckCode::F841,
CheckCode::F901, CheckCode::F901,
])), ])),

View File

@ -51,7 +51,7 @@ impl Settings {
CheckCode::F634, CheckCode::F634,
CheckCode::F706, CheckCode::F706,
CheckCode::F831, CheckCode::F831,
CheckCode::F832, CheckCode::F823,
CheckCode::F901, CheckCode::F901,
]) ])
}), }),