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
|
||||
pub fn consider_using_from_import(checker: &mut Checker, alias: &Alias) {
|
||||
if let Some(asname) = &alias.node.asname {
|
||||
if let Some((_, module)) = alias.node.name.rsplit_once('.') {
|
||||
if module == asname {
|
||||
if let Some((module, name)) = alias.node.name.rsplit_once('.') {
|
||||
if name == asname {
|
||||
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),
|
||||
));
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ expression: checks
|
|||
---
|
||||
- kind:
|
||||
ConsiderUsingFromImport:
|
||||
- path
|
||||
- os
|
||||
- path
|
||||
location:
|
||||
row: 8
|
||||
|
@ -15,7 +15,7 @@ expression: checks
|
|||
fix: ~
|
||||
- kind:
|
||||
ConsiderUsingFromImport:
|
||||
- foobar
|
||||
- foo.bar
|
||||
- foobar
|
||||
location:
|
||||
row: 10
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue