mirror of https://github.com/astral-sh/ruff
Negate ignore_names condition
This commit is contained in:
parent
6be910ae07
commit
dc180dc277
|
|
@ -1,4 +1,4 @@
|
|||
use rustpython_ast::{Located};
|
||||
use rustpython_ast::Located;
|
||||
|
||||
use crate::ast::types::Range;
|
||||
use crate::checks::{Check, CheckKind};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
use rustpython_ast::{ExcepthandlerKind, ExprKind, Stmt, StmtKind};
|
||||
|
||||
use crate::ast::helpers::identifier_range;
|
||||
|
||||
use crate::checks::{Check, CheckKind};
|
||||
use crate::source_code_locator::SourceCodeLocator;
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ pub fn invalid_function_name(
|
|||
ignore_names: &[String],
|
||||
locator: &SourceCodeLocator,
|
||||
) -> Option<Check> {
|
||||
if name.to_lowercase() != name && ignore_names.iter().any(|ignore_name| ignore_name == name) {
|
||||
if name.to_lowercase() != name && !ignore_names.iter().any(|ignore_name| ignore_name == name) {
|
||||
return Some(Check::new(
|
||||
CheckKind::InvalidFunctionName(name.to_string()),
|
||||
identifier_range(func_def, locator),
|
||||
|
|
|
|||
|
|
@ -3,21 +3,48 @@ source: src/pep8_naming/mod.rs
|
|||
expression: checks
|
||||
---
|
||||
- kind:
|
||||
InvalidFunctionName: tearDownModule
|
||||
InvalidFunctionName: Bad
|
||||
location:
|
||||
row: 32
|
||||
row: 4
|
||||
column: 4
|
||||
end_location:
|
||||
row: 32
|
||||
column: 18
|
||||
row: 4
|
||||
column: 7
|
||||
fix: ~
|
||||
- kind:
|
||||
InvalidFunctionName: tearDown
|
||||
InvalidFunctionName: _Bad
|
||||
location:
|
||||
row: 37
|
||||
row: 8
|
||||
column: 4
|
||||
end_location:
|
||||
row: 8
|
||||
column: 8
|
||||
fix: ~
|
||||
- kind:
|
||||
InvalidFunctionName: BAD
|
||||
location:
|
||||
row: 12
|
||||
column: 4
|
||||
end_location:
|
||||
row: 12
|
||||
column: 7
|
||||
fix: ~
|
||||
- kind:
|
||||
InvalidFunctionName: BAD_FUNC
|
||||
location:
|
||||
row: 16
|
||||
column: 4
|
||||
end_location:
|
||||
row: 16
|
||||
column: 12
|
||||
fix: ~
|
||||
- kind:
|
||||
InvalidFunctionName: testTest
|
||||
location:
|
||||
row: 40
|
||||
column: 8
|
||||
end_location:
|
||||
row: 37
|
||||
row: 40
|
||||
column: 16
|
||||
fix: ~
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue