Skip to content

Commit

Permalink
[airflow]: extend moved names (AIR303) (#15145)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lee-W authored Dec 26, 2024
1 parent 8b9c843 commit 5d6aae8
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 40 deletions.
3 changes: 3 additions & 0 deletions crates/ruff_linter/resources/test/fixtures/airflow/AIR303.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from airflow.auth.managers.fab.api.auth.backend import (
kerberos_auth as backend_kerberos_auth,
)
from airflow.config_templates.default_celery import DEFAULT_CELERY_CONFIG
from airflow.auth.managers.fab.fab_auth_manager import FabAuthManager
from airflow.auth.managers.fab.security_manager import override as fab_override
from airflow.www.security import FabAirflowSecurityManagerOverride
Expand All @@ -14,3 +15,5 @@

FabAuthManager
FabAirflowSecurityManagerOverride

DEFAULT_CELERY_CONFIG
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ fn moved_to_provider(checker: &mut Checker, expr: &Expr, ranged: impl Ranged) {
version: "1.0.0"
},
)),
["airflow","auth","managers","fab","fab_auth_manager", "FabAuthManager"] => Some((
["airflow", "auth", "managers", "fab", "fab_auth_manager", "FabAuthManager"] => Some((
qualname.to_string(),
Replacement::ProviderName{
name: "airflow.providers.fab.auth_manager.security_manager.FabAuthManager",
Expand All @@ -128,7 +128,7 @@ fn moved_to_provider(checker: &mut Checker, expr: &Expr, ranged: impl Ranged) {
version: "1.0.0"
},
)),
["airflow", "api","auth","backend","kerberos_auth", ..] => Some((
["airflow", "api", "auth", "backend", "kerberos_auth", ..] => Some((
qualname.to_string(),
Replacement::ImportPathMoved{
original_path:"airflow.api.auth.backend.kerberos_auth",
Expand All @@ -146,15 +146,25 @@ fn moved_to_provider(checker: &mut Checker, expr: &Expr, ranged: impl Ranged) {
version: "1.0.0"
},
)),
["airflow","auth","managers","fab","security_manager","override", ..] => Some((
["airflow", "auth", "managers", "fab", "security_manager", "override", ..] => Some((
qualname.to_string(),
Replacement::ImportPathMoved{
original_path: "airflow.auth.managers.fab.security_manager.override",
original_path: "airflow.auth.managers.fab.security_managr.override",
new_path: "airflow.providers.fab.auth_manager.security_manager.override",
provider: "fab",
version: "1.0.0"
},
)),
// apache-airflow-providers-celery
["airflow", "config_templates", "default_celery", "DEFAULT_CELERY_CONFIG"] => Some((
qualname.to_string(),
Replacement::ImportPathMoved{
original_path: "airflow.config_templates.default_celery.DEFAULT_CELERY_CONFIG",
new_path: "airflow.providers.celery.executors.default_celery.DEFAULT_CELERY_CONFIG",
provider: "celery",
version: "3.3.0"
},
)),

_ => None,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,73 +2,84 @@
source: crates/ruff_linter/src/rules/airflow/mod.rs
snapshot_kind: text
---
AIR303.py:10:1: AIR303 Import path `airflow.api.auth.backend.basic_auth` is moved into `fab` provider in Airflow 3.0;
AIR303.py:11:1: AIR303 Import path `airflow.api.auth.backend.basic_auth` is moved into `fab` provider in Airflow 3.0;
|
8 | from airflow.www.security import FabAirflowSecurityManagerOverride
9 |
10 | basic_auth, kerberos_auth
9 | from airflow.www.security import FabAirflowSecurityManagerOverride
10 |
11 | basic_auth, kerberos_auth
| ^^^^^^^^^^ AIR303
11 | auth_current_user
12 | backend_kerberos_auth
12 | auth_current_user
13 | backend_kerberos_auth
|
= help: Install `apache-airflow-provider-fab>=1.0.0` and import from `airflow.providers.fab.auth_manager.api.auth.backend.basic_auth` instead.

AIR303.py:10:13: AIR303 Import path `airflow.api.auth.backend.kerberos_auth` is moved into `fab` provider in Airflow 3.0;
AIR303.py:11:13: AIR303 Import path `airflow.api.auth.backend.kerberos_auth` is moved into `fab` provider in Airflow 3.0;
|
8 | from airflow.www.security import FabAirflowSecurityManagerOverride
9 |
10 | basic_auth, kerberos_auth
9 | from airflow.www.security import FabAirflowSecurityManagerOverride
10 |
11 | basic_auth, kerberos_auth
| ^^^^^^^^^^^^^ AIR303
11 | auth_current_user
12 | backend_kerberos_auth
12 | auth_current_user
13 | backend_kerberos_auth
|
= help: Install `apache-airflow-provider-fab>=1.0.0` and import from `airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth` instead.

AIR303.py:11:1: AIR303 Import path `airflow.api.auth.backend.basic_auth` is moved into `fab` provider in Airflow 3.0;
AIR303.py:12:1: AIR303 Import path `airflow.api.auth.backend.basic_auth` is moved into `fab` provider in Airflow 3.0;
|
10 | basic_auth, kerberos_auth
11 | auth_current_user
11 | basic_auth, kerberos_auth
12 | auth_current_user
| ^^^^^^^^^^^^^^^^^ AIR303
12 | backend_kerberos_auth
13 | fab_override
13 | backend_kerberos_auth
14 | fab_override
|
= help: Install `apache-airflow-provider-fab>=1.0.0` and import from `airflow.providers.fab.auth_manager.api.auth.backend.basic_auth` instead.

AIR303.py:12:1: AIR303 Import path `airflow.auth_manager.api.auth.backend.kerberos_auth` is moved into `fab` provider in Airflow 3.0;
AIR303.py:13:1: AIR303 Import path `airflow.auth_manager.api.auth.backend.kerberos_auth` is moved into `fab` provider in Airflow 3.0;
|
10 | basic_auth, kerberos_auth
11 | auth_current_user
12 | backend_kerberos_auth
11 | basic_auth, kerberos_auth
12 | auth_current_user
13 | backend_kerberos_auth
| ^^^^^^^^^^^^^^^^^^^^^ AIR303
13 | fab_override
14 | fab_override
|
= help: Install `apache-airflow-provider-fab>=1.0.0` and import from `airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth` instead.

AIR303.py:13:1: AIR303 Import path `airflow.auth.managers.fab.security_manager.override` is moved into `fab` provider in Airflow 3.0;
AIR303.py:14:1: AIR303 Import path `airflow.auth.managers.fab.security_managr.override` is moved into `fab` provider in Airflow 3.0;
|
11 | auth_current_user
12 | backend_kerberos_auth
13 | fab_override
12 | auth_current_user
13 | backend_kerberos_auth
14 | fab_override
| ^^^^^^^^^^^^ AIR303
14 |
15 | FabAuthManager
15 |
16 | FabAuthManager
|
= help: Install `apache-airflow-provider-fab>=1.0.0` and import from `airflow.providers.fab.auth_manager.security_manager.override` instead.

AIR303.py:15:1: AIR303 `airflow.auth.managers.fab.fab_auth_manager.FabAuthManager` is moved into `fab` provider in Airflow 3.0;
AIR303.py:16:1: AIR303 `airflow.auth.managers.fab.fab_auth_manager.FabAuthManager` is moved into `fab` provider in Airflow 3.0;
|
13 | fab_override
14 |
15 | FabAuthManager
14 | fab_override
15 |
16 | FabAuthManager
| ^^^^^^^^^^^^^^ AIR303
16 | FabAirflowSecurityManagerOverride
17 | FabAirflowSecurityManagerOverride
|
= help: Install `apache-airflow-provider-fab>=1.0.0` and use `airflow.providers.fab.auth_manager.security_manager.FabAuthManager` instead.

AIR303.py:16:1: AIR303 `airflow.www.security.FabAirflowSecurityManagerOverride` is moved into `fab` provider in Airflow 3.0;
AIR303.py:17:1: AIR303 `airflow.www.security.FabAirflowSecurityManagerOverride` is moved into `fab` provider in Airflow 3.0;
|
15 | FabAuthManager
16 | FabAirflowSecurityManagerOverride
16 | FabAuthManager
17 | FabAirflowSecurityManagerOverride
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AIR303
18 |
19 | DEFAULT_CELERY_CONFIG
|
= help: Install `apache-airflow-provider-fab>=1.0.0` and use `airflow.providers.fab.auth_manager.security_manager.override.FabAirflowSecurityManagerOverride` instead.

AIR303.py:19:1: AIR303 Import path `airflow.config_templates.default_celery.DEFAULT_CELERY_CONFIG` is moved into `celery` provider in Airflow 3.0;
|
17 | FabAirflowSecurityManagerOverride
18 |
19 | DEFAULT_CELERY_CONFIG
| ^^^^^^^^^^^^^^^^^^^^^ AIR303
|
= help: Install `apache-airflow-provider-celery>=3.3.0` and import from `airflow.providers.celery.executors.default_celery.DEFAULT_CELERY_CONFIG` instead.

0 comments on commit 5d6aae8

Please sign in to comment.