File tree 1 file changed +6
-1
lines changed
crates/ruff_linter/src/rules/airflow/rules
1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ use ruff_diagnostics::{Diagnostic, Violation};
2
2
use ruff_macros:: { derive_message_formats, violation} ;
3
3
use ruff_python_ast as ast;
4
4
use ruff_python_ast:: Expr ;
5
+ use ruff_python_semantic:: Modules ;
5
6
use ruff_text_size:: Ranged ;
6
7
7
8
use crate :: checkers:: ast:: Checker ;
@@ -49,6 +50,10 @@ pub(crate) fn variable_name_task_id(
49
50
targets : & [ Expr ] ,
50
51
value : & Expr ,
51
52
) -> Option < Diagnostic > {
53
+ if !checker. semantic ( ) . seen_module ( Modules :: AIRFLOW ) {
54
+ return None ;
55
+ }
56
+
52
57
// If we have more than one target, we can't do anything.
53
58
let [ target] = targets else {
54
59
return None ;
@@ -69,7 +74,7 @@ pub(crate) fn variable_name_task_id(
69
74
if !checker
70
75
. semantic ( )
71
76
. resolve_qualified_name ( func)
72
- . is_some_and ( |qualified_name| matches ! ( qualified_name. segments( ) [ 0 ] , "airflow" ) )
77
+ . is_some_and ( |qualified_name| matches ! ( qualified_name. segments( ) , [ "airflow" , .. ] ) )
73
78
{
74
79
return None ;
75
80
}
You can’t perform that action at this time.
0 commit comments