Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,11 @@
SqlSensor()


from airflow.operators.jdbc_operator import JdbcOperator
from airflow.operators.mssql_operator import MsSqlOperator
from airflow.operators.mysql_operator import MySqlOperator
from airflow.operators.oracle_operator import OracleOperator
from airflow.operators.postgres_operator import PostgresOperator
from airflow.operators.sqlite_operator import SqliteOperator

JdbcOperator()
MsSqlOperator()
MySqlOperator()
OracleOperator()
PostgresOperator()
SqliteOperator()
from airflow.providers.common.sql.operators.sql import SQLExecuteQueryOperator

SQLExecuteQueryOperator()
SQLExecuteQueryOperator()
SQLExecuteQueryOperator()
SQLExecuteQueryOperator()
SQLExecuteQueryOperator()
SQLExecuteQueryOperator()
Original file line number Diff line number Diff line change
Expand Up @@ -65,24 +65,26 @@ impl Violation for Airflow3MovedToProvider {

fn fix_title(&self) -> Option<String> {
let Airflow3MovedToProvider { replacement, .. } = self;
match replacement {
ProviderReplacement::None => None,
if let Some((module, name, provider, version)) = match &replacement {
ProviderReplacement::AutoImport {
name,
module,
name,
provider,
version,
} => Some(format!(
"Install `apache-airflow-providers-{provider}>={version}` and use `{module}.{name}` instead."
)),
} => Some((module, *name, provider, version)),
ProviderReplacement::SourceModuleMovedToProvider {
name,
module,
name,
provider,
version,
} => Some(format!(
"Install `apache-airflow-providers-{provider}>={version}` and use `{module}.{name}` instead."
)),
} => Some((module, name.as_str(), provider, version)),
ProviderReplacement::None => None,
} {
Some(format!(
"Install `apache-airflow-providers-{provider}>={version}` and use `{name}` from `{module}` instead."
))
} else {
None
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/ruff_linter/src/rules/airflow/rules/removal_in_3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ impl Violation for Airflow3Removal {
Replacement::AttrName(name) => Some(format!("Use `{name}` instead")),
Replacement::Message(message) => Some((*message).to_string()),
Replacement::AutoImport { module, name } => {
Some(format!("Use `{module}.{name}` instead"))
Some(format!("Use `{name}` from `{module}` instead."))
}
Replacement::SourceModuleMoved { module, name } => {
Some(format!("Use `{module}.{name}` instead"))
Some(format!("Use `{name}` from `{module}` instead."))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ impl Violation for Airflow3SuggestedToMoveToProvider {
provider,
version,
} => Some(format!(
"Install `apache-airflow-providers-{provider}>={version}` and use `{module}.{name}` instead."
"Install `apache-airflow-providers-{provider}>={version}` and use `{name}` from `{module}` instead."
)),
ProviderReplacement::SourceModuleMovedToProvider {
module,
name,
provider,
version,
} => Some(format!(
"Install `apache-airflow-providers-{provider}>={version}` and use `{module}.{name}` instead."
"Install `apache-airflow-providers-{provider}>={version}` and use `{name}` from `{module}` instead."
)),
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ impl Violation for Airflow3SuggestedUpdate {
Replacement::AttrName(name) => Some(format!("Use `{name}` instead")),
Replacement::Message(message) => Some((*message).to_string()),
Replacement::AutoImport { module, name } => {
Some(format!("Use `{module}.{name}` instead"))
Some(format!("Use `{name}` from `{module}` instead."))
}
Replacement::SourceModuleMoved { module, name } => {
Some(format!("Use `{module}.{name}` instead"))
Some(format!("Use `{name}` from `{module}` instead."))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ AIR301_class_attribute.py:42:6: AIR301 [*] `airflow.datasets.manager.DatasetMana
43 | dm.register_dataset_change()
44 | dm.create_datasets()
|
= help: Use `airflow.assets.manager.AssetManager` instead
= help: Use `AssetManager` from `airflow.assets.manager` instead.

ℹ Safe fix
19 19 | from airflow.providers_manager import ProvidersManager
Expand Down Expand Up @@ -302,7 +302,7 @@ AIR301_class_attribute.py:50:11: AIR301 [*] `airflow.lineage.hook.DatasetLineage
| ^^^^^^^^^^^^^^^^^^ AIR301
51 | dl_info.dataset
|
= help: Use `airflow.lineage.hook.AssetLineageInfo` instead
= help: Use `AssetLineageInfo` from `airflow.lineage.hook` instead.

ℹ Safe fix
9 9 | DatasetAny,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ AIR301_names.py:60:1: AIR301 [*] `airflow.configuration.get` is removed in Airfl
60 | get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
| ^^^ AIR301
|
= help: Use `airflow.configuration.conf.get` instead
= help: Use `conf.get` from `airflow.configuration` instead.

ℹ Safe fix
19 19 | has_option,
Expand All @@ -111,7 +111,7 @@ AIR301_names.py:60:6: AIR301 [*] `airflow.configuration.getboolean` is removed i
60 | get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
| ^^^^^^^^^^ AIR301
|
= help: Use `airflow.configuration.conf.getboolean` instead
= help: Use `conf.getboolean` from `airflow.configuration` instead.

ℹ Safe fix
19 19 | has_option,
Expand All @@ -137,7 +137,7 @@ AIR301_names.py:60:18: AIR301 [*] `airflow.configuration.getfloat` is removed in
60 | get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
| ^^^^^^^^ AIR301
|
= help: Use `airflow.configuration.conf.getfloat` instead
= help: Use `conf.getfloat` from `airflow.configuration` instead.

ℹ Safe fix
19 19 | has_option,
Expand All @@ -163,7 +163,7 @@ AIR301_names.py:60:28: AIR301 [*] `airflow.configuration.getint` is removed in A
60 | get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
| ^^^^^^ AIR301
|
= help: Use `airflow.configuration.conf.getint` instead
= help: Use `conf.getint` from `airflow.configuration` instead.

ℹ Safe fix
19 19 | has_option,
Expand All @@ -189,7 +189,7 @@ AIR301_names.py:60:36: AIR301 [*] `airflow.configuration.has_option` is removed
60 | get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
| ^^^^^^^^^^ AIR301
|
= help: Use `airflow.configuration.conf.has_option` instead
= help: Use `conf.has_option` from `airflow.configuration` instead.

ℹ Safe fix
19 19 | has_option,
Expand All @@ -215,7 +215,7 @@ AIR301_names.py:60:48: AIR301 [*] `airflow.configuration.remove_option` is remov
60 | get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
| ^^^^^^^^^^^^^ AIR301
|
= help: Use `airflow.configuration.conf.remove_option` instead
= help: Use `conf.remove_option` from `airflow.configuration` instead.

ℹ Safe fix
19 19 | has_option,
Expand All @@ -241,7 +241,7 @@ AIR301_names.py:60:63: AIR301 [*] `airflow.configuration.as_dict` is removed in
60 | get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
| ^^^^^^^ AIR301
|
= help: Use `airflow.configuration.conf.as_dict` instead
= help: Use `conf.as_dict` from `airflow.configuration` instead.

ℹ Safe fix
19 19 | has_option,
Expand All @@ -267,7 +267,7 @@ AIR301_names.py:60:72: AIR301 [*] `airflow.configuration.set` is removed in Airf
60 | get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
| ^^^ AIR301
|
= help: Use `airflow.configuration.conf.set` instead
= help: Use `conf.set` from `airflow.configuration` instead.

ℹ Safe fix
19 19 | has_option,
Expand Down Expand Up @@ -308,7 +308,7 @@ AIR301_names.py:72:1: AIR301 `airflow.hooks.base_hook.BaseHook` is removed in Ai
72 | BaseHook()
| ^^^^^^^^ AIR301
|
= help: Use `airflow.hooks.base.BaseHook` instead
= help: Use `BaseHook` from `airflow.hooks.base` instead.

AIR301_names.py:76:1: AIR301 `airflow.operators.subdag.SubDagOperator` is removed in Airflow 3.0
|
Expand All @@ -324,7 +324,7 @@ AIR301_names.py:85:1: AIR301 `airflow.sensors.base_sensor_operator.BaseSensorOpe
85 | BaseSensorOperator()
| ^^^^^^^^^^^^^^^^^^ AIR301
|
= help: Use `airflow.sdk.bases.sensor.BaseSensorOperator` instead
= help: Use `BaseSensorOperator` from `airflow.sdk.bases.sensor` instead.

AIR301_names.py:89:1: AIR301 `airflow.triggers.external_task.TaskStateTrigger` is removed in Airflow 3.0
|
Expand Down Expand Up @@ -446,7 +446,7 @@ AIR301_names.py:117:1: AIR301 `airflow.utils.file.TemporaryDirectory` is removed
| ^^^^^^^^^^^^^^^^^^ AIR301
118 | mkdirs
|
= help: Use `tempfile.TemporaryDirectory` instead
= help: Use `TemporaryDirectory` from `tempfile` instead.

AIR301_names.py:118:1: AIR301 `airflow.utils.file.mkdirs` is removed in Airflow 3.0
|
Expand All @@ -466,7 +466,7 @@ AIR301_names.py:121:1: AIR301 [*] `airflow.utils.helpers.chain` is removed in Ai
| ^^^^^^^^^^^^ AIR301
122 | helper_cross_downstream
|
= help: Use `airflow.sdk.chain` instead
= help: Use `chain` from `airflow.sdk` instead.

ℹ Safe fix
48 48 | from airflow.utils.trigger_rule import TriggerRule
Expand Down Expand Up @@ -495,7 +495,7 @@ AIR301_names.py:122:1: AIR301 [*] `airflow.utils.helpers.cross_downstream` is re
123 |
124 | # airflow.utils.log
|
= help: Use `airflow.sdk.cross_downstream` instead
= help: Use `cross_downstream` from `airflow.sdk` instead.

ℹ Safe fix
48 48 | from airflow.utils.trigger_rule import TriggerRule
Expand Down Expand Up @@ -523,7 +523,7 @@ AIR301_names.py:125:1: AIR301 `airflow.utils.log.secrets_masker` is removed in A
126 |
127 | # airflow.utils.state
|
= help: Use `airflow.sdk.execution_time.secrets_masker` instead
= help: Use `secrets_masker` from `airflow.sdk.execution_time` instead.

AIR301_names.py:128:1: AIR301 `airflow.utils.state.SHUTDOWN` is removed in Airflow 3.0
|
Expand Down Expand Up @@ -595,7 +595,7 @@ AIR301_names.py:146:1: AIR301 `airflow.operators.python.get_current_context` is
147 |
148 | # airflow.providers.mysql
|
= help: Use `airflow.sdk.get_current_context` instead
= help: Use `get_current_context` from `airflow.sdk` instead.

AIR301_names.py:151:1: AIR301 `airflow.providers.mysql.datasets.mysql.sanitize_uri` is removed in Airflow 3.0
|
Expand All @@ -606,7 +606,7 @@ AIR301_names.py:151:1: AIR301 `airflow.providers.mysql.datasets.mysql.sanitize_u
152 |
153 | # airflow.providers.postgres
|
= help: Use `airflow.providers.mysql.assets.mysql.sanitize_uri` instead
= help: Use `sanitize_uri` from `airflow.providers.mysql.assets.mysql` instead.

AIR301_names.py:156:1: AIR301 `airflow.providers.postgres.datasets.postgres.sanitize_uri` is removed in Airflow 3.0
|
Expand All @@ -617,7 +617,7 @@ AIR301_names.py:156:1: AIR301 `airflow.providers.postgres.datasets.postgres.sani
157 |
158 | # airflow.providers.trino
|
= help: Use `airflow.providers.postgres.assets.postgres.sanitize_uri` instead
= help: Use `sanitize_uri` from `airflow.providers.postgres.assets.postgres` instead.

AIR301_names.py:161:1: AIR301 `airflow.providers.trino.datasets.trino.sanitize_uri` is removed in Airflow 3.0
|
Expand All @@ -628,7 +628,7 @@ AIR301_names.py:161:1: AIR301 `airflow.providers.trino.datasets.trino.sanitize_u
162 |
163 | # airflow.notifications.basenotifier
|
= help: Use `airflow.providers.trino.assets.trino.sanitize_uri` instead
= help: Use `sanitize_uri` from `airflow.providers.trino.assets.trino` instead.

AIR301_names.py:166:1: AIR301 `airflow.notifications.basenotifier.BaseNotifier` is removed in Airflow 3.0
|
Expand All @@ -639,7 +639,7 @@ AIR301_names.py:166:1: AIR301 `airflow.notifications.basenotifier.BaseNotifier`
167 |
168 | # airflow.auth.manager
|
= help: Use `airflow.sdk.bases.notifier.BaseNotifier` instead
= help: Use `BaseNotifier` from `airflow.sdk.bases.notifier` instead.

AIR301_names.py:171:1: AIR301 `airflow.auth.managers.base_auth_manager.BaseAuthManager` is removed in Airflow 3.0
|
Expand All @@ -648,4 +648,4 @@ AIR301_names.py:171:1: AIR301 `airflow.auth.managers.base_auth_manager.BaseAuthM
171 | BaseAuthManager()
| ^^^^^^^^^^^^^^^ AIR301
|
= help: Use `airflow.api_fastapi.auth.managers.base_auth_manager.BaseAuthManager` instead
= help: Use `BaseAuthManager` from `airflow.api_fastapi.auth.managers.base_auth_manager` instead.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ AIR301_names_fix.py:19:1: AIR301 [*] `airflow.api_connexion.security.requires_ac
20 |
21 | DatasetDetails()
|
= help: Use `airflow.api_fastapi.core_api.security.requires_access_asset` instead
= help: Use `requires_access_asset` from `airflow.api_fastapi.core_api.security` instead.

ℹ Safe fix
15 15 | from airflow.secrets.local_filesystm import load_connections
Expand All @@ -31,7 +31,7 @@ AIR301_names_fix.py:21:1: AIR301 [*] `airflow.auth.managers.models.resource_deta
21 | DatasetDetails()
| ^^^^^^^^^^^^^^ AIR301
|
= help: Use `airflow.api_fastapi.auth.managers.models.resource_details.AssetDetails` instead
= help: Use `AssetDetails` from `airflow.api_fastapi.auth.managers.models.resource_details` instead.

ℹ Safe fix
15 15 | from airflow.secrets.local_filesystm import load_connections
Expand All @@ -54,7 +54,7 @@ AIR301_names_fix.py:24:1: AIR301 [*] `airflow.datasets.manager.DatasetManager` i
25 | dataset_manager()
26 | resolve_dataset_manager()
|
= help: Use `airflow.assets.manager.AssetManager` instead
= help: Use `AssetManager` from `airflow.assets.manager` instead.

ℹ Safe fix
15 15 | from airflow.secrets.local_filesystm import load_connections
Expand All @@ -80,7 +80,7 @@ AIR301_names_fix.py:25:1: AIR301 [*] `airflow.datasets.manager.dataset_manager`
| ^^^^^^^^^^^^^^^ AIR301
26 | resolve_dataset_manager()
|
= help: Use `airflow.assets.manager.asset_manager` instead
= help: Use `asset_manager` from `airflow.assets.manager` instead.

ℹ Safe fix
15 15 | from airflow.secrets.local_filesystm import load_connections
Expand Down Expand Up @@ -109,7 +109,7 @@ AIR301_names_fix.py:26:1: AIR301 [*] `airflow.datasets.manager.resolve_dataset_m
27 |
28 | DatasetLineageInfo()
|
= help: Use `airflow.assets.manager.resolve_asset_manager` instead
= help: Use `resolve_asset_manager` from `airflow.assets.manager` instead.

ℹ Safe fix
15 15 | from airflow.secrets.local_filesystm import load_connections
Expand Down Expand Up @@ -138,7 +138,7 @@ AIR301_names_fix.py:28:1: AIR301 [*] `airflow.lineage.hook.DatasetLineageInfo` i
29 |
30 | AllowListValidator()
|
= help: Use `airflow.lineage.hook.AssetLineageInfo` instead
= help: Use `AssetLineageInfo` from `airflow.lineage.hook` instead.

ℹ Safe fix
10 10 | dataset_manager,
Expand Down Expand Up @@ -167,7 +167,7 @@ AIR301_names_fix.py:30:1: AIR301 [*] `airflow.metrics.validators.AllowListValida
| ^^^^^^^^^^^^^^^^^^ AIR301
31 | BlockListValidator()
|
= help: Use `airflow.metrics.validators.PatternAllowListValidator` instead
= help: Use `PatternAllowListValidator` from `airflow.metrics.validators` instead.

ℹ Safe fix
11 11 | resolve_dataset_manager,
Expand Down Expand Up @@ -196,7 +196,7 @@ AIR301_names_fix.py:31:1: AIR301 [*] `airflow.metrics.validators.BlockListValida
32 |
33 | load_connections()
|
= help: Use `airflow.metrics.validators.PatternBlockListValidator` instead
= help: Use `PatternBlockListValidator` from `airflow.metrics.validators` instead.

ℹ Safe fix
11 11 | resolve_dataset_manager,
Expand Down Expand Up @@ -226,7 +226,7 @@ AIR301_names_fix.py:35:1: AIR301 [*] `airflow.security.permissions.RESOURCE_DATA
36 |
37 | has_access_dataset()
|
= help: Use `airflow.security.permissions.RESOURCE_ASSET` instead
= help: Use `RESOURCE_ASSET` from `airflow.security.permissions` instead.

ℹ Safe fix
13 13 | from airflow.lineage.hook import DatasetLineageInfo
Expand Down Expand Up @@ -265,7 +265,7 @@ AIR301_names_fix.py:44:1: AIR301 [*] `airflow.listeners.spec.dataset.on_dataset_
| ^^^^^^^^^^^^^^^^^^ AIR301
45 | on_dataset_changed()
|
= help: Use `airflow.listeners.spec.asset.on_asset_created` instead
= help: Use `on_asset_created` from `airflow.listeners.spec.asset` instead.

ℹ Safe fix
40 40 | on_dataset_changed,
Expand All @@ -283,7 +283,7 @@ AIR301_names_fix.py:45:1: AIR301 [*] `airflow.listeners.spec.dataset.on_dataset_
45 | on_dataset_changed()
| ^^^^^^^^^^^^^^^^^^ AIR301
|
= help: Use `airflow.listeners.spec.asset.on_asset_changed` instead
= help: Use `on_asset_changed` from `airflow.listeners.spec.asset` instead.

ℹ Safe fix
40 40 | on_dataset_changed,
Expand Down
Loading
Loading