mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 05:45:24 +00:00
Fix PLR0402
(#1024)
This commit is contained in:
parent
4994b72ba2
commit
21cace0973
2 changed files with 5 additions and 5 deletions
|
@ -110,10 +110,10 @@ pub fn property_with_parameters(
|
||||||
/// PLR0402
|
/// PLR0402
|
||||||
pub fn consider_using_from_import(checker: &mut Checker, alias: &Alias) {
|
pub fn consider_using_from_import(checker: &mut Checker, alias: &Alias) {
|
||||||
if let Some(asname) = &alias.node.asname {
|
if let Some(asname) = &alias.node.asname {
|
||||||
if let Some((_, module)) = alias.node.name.rsplit_once('.') {
|
if let Some((module, name)) = alias.node.name.rsplit_once('.') {
|
||||||
if module == asname {
|
if name == asname {
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::ConsiderUsingFromImport(module.to_string(), asname.to_string()),
|
CheckKind::ConsiderUsingFromImport(module.to_string(), name.to_string()),
|
||||||
Range::from_located(alias),
|
Range::from_located(alias),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ expression: checks
|
||||||
---
|
---
|
||||||
- kind:
|
- kind:
|
||||||
ConsiderUsingFromImport:
|
ConsiderUsingFromImport:
|
||||||
- path
|
- os
|
||||||
- path
|
- path
|
||||||
location:
|
location:
|
||||||
row: 8
|
row: 8
|
||||||
|
@ -15,7 +15,7 @@ expression: checks
|
||||||
fix: ~
|
fix: ~
|
||||||
- kind:
|
- kind:
|
||||||
ConsiderUsingFromImport:
|
ConsiderUsingFromImport:
|
||||||
- foobar
|
- foo.bar
|
||||||
- foobar
|
- foobar
|
||||||
location:
|
location:
|
||||||
row: 10
|
row: 10
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue