mirror of https://github.com/astral-sh/ruff
Fix F832 --> F823 typo
This commit is contained in:
parent
ba27e50164
commit
b2be81310f
|
|
@ -11,7 +11,7 @@ select = [
|
|||
"F706",
|
||||
"F821",
|
||||
"F831",
|
||||
"F832",
|
||||
"F823",
|
||||
"F841",
|
||||
"F901",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ other-attribute = 1
|
|||
CheckCode::F706,
|
||||
CheckCode::F821,
|
||||
CheckCode::F831,
|
||||
CheckCode::F832,
|
||||
CheckCode::F823,
|
||||
CheckCode::F841,
|
||||
CheckCode::F901,
|
||||
])),
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ impl Settings {
|
|||
CheckCode::F634,
|
||||
CheckCode::F706,
|
||||
CheckCode::F831,
|
||||
CheckCode::F832,
|
||||
CheckCode::F823,
|
||||
CheckCode::F901,
|
||||
])
|
||||
}),
|
||||
|
|
|
|||
Loading…
Reference in New Issue