Skip to content

Commit b6281a8

Browse files
authored
[airflow] update existing AIR302 rules with better suggestions (#17542)
## Summary Even though the original suggestion works, they've been removed in later version and is no longer the best practices. e.g., many sql realted operators have been removed and are now suggested to use SQLExecuteQueryOperator instead ## Test Plan The existing test fixtures have been updated
1 parent 049280a commit b6281a8

File tree

5 files changed

+158
-181
lines changed

5 files changed

+158
-181
lines changed

crates/ruff_linter/resources/test/fixtures/airflow/AIR302.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,18 +139,18 @@
139139
from airflow.operators.pig_operator import PigOperator
140140
from airflow.operators.postgres_operator import Mapping, PostgresOperator
141141
from airflow.operators.presto_check_operator import (
142-
PrestoCheckOperator,
143-
PrestoIntervalCheckOperator,
144-
PrestoValueCheckOperator,
142+
CheckOperator as SQLCheckOperator2,
145143
)
146144
from airflow.operators.presto_check_operator import (
147-
SQLCheckOperator as SQLCheckOperator2,
145+
IntervalCheckOperator as SQLIntervalCheckOperator2,
148146
)
149147
from airflow.operators.presto_check_operator import (
150-
SQLIntervalCheckOperator as SQLIntervalCheckOperator2,
148+
PrestoCheckOperator,
149+
PrestoIntervalCheckOperator,
150+
PrestoValueCheckOperator,
151151
)
152152
from airflow.operators.presto_check_operator import (
153-
SQLValueCheckOperator as SQLValueCheckOperator2,
153+
ValueCheckOperator as SQLValueCheckOperator2,
154154
)
155155
from airflow.operators.presto_to_mysql import (
156156
PrestoToMySqlOperator,

crates/ruff_linter/src/rules/airflow/helpers.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pub(crate) enum Replacement {
2121

2222
#[derive(Debug, Eq, PartialEq)]
2323
pub(crate) enum ProviderReplacement {
24+
None,
2425
ProviderName {
2526
name: &'static str,
2627
provider: &'static str,

0 commit comments

Comments
 (0)