From 4550581be209947f783c5768f415dac0313434e6 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Wed, 2 Nov 2022 22:38:29 -0400 Subject: [PATCH] Relax lowercase condition in N806 (#562) --- resources/test/fixtures/N806.py | 1 + src/pep8_naming/checks.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/test/fixtures/N806.py b/resources/test/fixtures/N806.py index 891129de03..6a3772cc60 100644 --- a/resources/test/fixtures/N806.py +++ b/resources/test/fixtures/N806.py @@ -2,3 +2,4 @@ def f(): lower = 0 Camel = 0 CONSTANT = 0 + _ = 0 diff --git a/src/pep8_naming/checks.rs b/src/pep8_naming/checks.rs index e2cbf481ff..0f8d068b11 100644 --- a/src/pep8_naming/checks.rs +++ b/src/pep8_naming/checks.rs @@ -118,7 +118,7 @@ pub fn non_lowercase_variable_in_function(scope: &Scope, expr: &Expr, name: &str if !matches!(scope.kind, ScopeKind::Function(FunctionScope { .. })) { return None; } - if !is_lower(name) { + if name.to_lowercase() != name { return Some(Check::new( CheckKind::NonLowercaseVariableInFunction(name.to_string()), Range::from_located(expr),