Improve `T20X` ranges (#1502)

This commit is contained in:
Harutaka Kawamura 2022-12-31 21:41:53 +09:00 committed by GitHub
parent 926b5494ad
commit 4e9e58bdc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 10 deletions

View File

@ -1708,7 +1708,7 @@ where
if self.settings.enabled.contains(&CheckCode::T201)
|| self.settings.enabled.contains(&CheckCode::T203)
{
flake8_print::plugins::print_call(self, expr, func, keywords);
flake8_print::plugins::print_call(self, func, keywords);
}
// flake8-bugbear

View File

@ -8,7 +8,7 @@ use crate::checkers::ast::Checker;
use crate::checks::{Check, CheckKind};
/// T201, T203
pub fn print_call(checker: &mut Checker, expr: &Expr, func: &Expr, keywords: &[Keyword]) {
pub fn print_call(checker: &mut Checker, func: &Expr, keywords: &[Keyword]) {
let mut check = {
let call_path = dealias_call_path(collect_call_paths(func), &checker.import_aliases);
if match_call_path(&call_path, "", "print", &checker.from_imports) {
@ -27,9 +27,9 @@ pub fn print_call(checker: &mut Checker, expr: &Expr, func: &Expr, keywords: &[K
}
}
}
Check::new(CheckKind::PrintFound, Range::from_located(expr))
Check::new(CheckKind::PrintFound, Range::from_located(func))
} else if match_call_path(&call_path, "pprint", "pprint", &checker.from_imports) {
Check::new(CheckKind::PPrintFound, Range::from_located(expr))
Check::new(CheckKind::PPrintFound, Range::from_located(func))
} else {
return;
}

View File

@ -8,7 +8,7 @@ expression: checks
column: 0
end_location:
row: 4
column: 22
column: 5
fix:
content: ""
location:
@ -24,7 +24,7 @@ expression: checks
column: 0
end_location:
row: 5
column: 33
column: 5
fix:
content: ""
location:
@ -40,7 +40,7 @@ expression: checks
column: 0
end_location:
row: 6
column: 39
column: 5
fix:
content: ""
location:
@ -56,7 +56,7 @@ expression: checks
column: 0
end_location:
row: 7
column: 39
column: 5
fix:
content: ""
location:

View File

@ -8,7 +8,7 @@ expression: checks
column: 0
end_location:
row: 3
column: 23
column: 6
fix:
content: ""
location:
@ -24,7 +24,7 @@ expression: checks
column: 0
end_location:
row: 7
column: 30
column: 13
fix:
content: ""
location: