-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[airflow] Update AIR301 and AIR311 with the latest Airflow implementations
#17985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
airflow] Update AIR301, AIR311 rules with the latest Airflow implemnetation
dedaab9 to
4e3f5ef
Compare
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| AIR311 | 19 | 19 | 0 | 0 | 0 |
| AIR301 | 4 | 2 | 2 | 0 | 0 |
7c2b1e3 to
bbaae8e
Compare
bbaae8e to
a455884
Compare
ntBre
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This overall looks good to me. I had a few minor suggestions and one question about the import code.
| diagnostic.try_set_fix(|| { | ||
| let (import_edit, binding) = checker.importer().get_or_import_symbol( | ||
| &ImportRequest::import_from(module, name), | ||
| let (import_edit, _) = checker.importer().get_or_import_symbol( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're supposed to use the binding returned by get_or_import_symbol. Was something going wrong here when you did that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There 2 cases like the following that need to be handled this way.
from airflow.providers.amazon.aws.auth_manager.avp.entities import AvpEntities
AvpEntities.DATASETwhich should be fixed as
from airflow.providers.amazon.aws.auth_manager.avp.entities import AvpEntities
AvpEntities.ASSETis we use binding, it will be fixed as
from airflow.providers.amazon.aws.auth_manager.avp.entities import AvpEntities
AvpEntitieswhich is wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I think that makes sense. Thanks!
f61f06c to
d75296e
Compare
…o `airflow.sdk.BaseOperatorLink` rule
* Remove the following rules
* name
* `airflow.auth.managers.base_auth_manager.is_authorized_dataset` → `airflow.api_fastapi.auth.managers.base_auth_manager.is_authorized_asset`
* `airflow.providers.fab.auth_manager.fab_auth_manager.is_authorized_dataset` → `airflow.providers.fab.auth_manager.fab_auth_manager.is_authorized_asset`
* Update the following rules
* name
* `airflow.api_connexion.security.requires_access` → "Use `airflow.api_fastapi.core_api.security.requires_access_*` instead`"
* `airflow.api_connexion.security.requires_access_dataset`→ `airflow.api_fastapi.core_api.security.requires_access_asset`
* `airflow.notifications.basenotifier.BaseNotifier` → `airflow.sdk.bases.notifier.BaseNotifier`
* `airflow.www.auth.has_access` → None
* `airflow.www.auth.has_access_dataset` → None
* `airflow.www.utils.get_sensitive_variables_fields`→ None
* `airflow.www.utils.should_hide_value_for_key`→ None
* Add the following rules
* class attribute
* `airflow.auth.managers.base_auth_manager.BaseAuthManager` | `airflow.providers.fab.auth_manager.fab_auth_manager.FabAuthManager`
* `is_authorized_dataset` → `is_authorized_asset`
* Update the following rules
* class attribute
* `airflow..sensors.weekday.DayOfWeekSensor`
* `use_task_execution_day` removed
* `airflow.providers.amazon.aws.auth_manager.aws_auth_manager.AwsAuthManager`
* `is_authorized_dataset`
* Add the following rules
* name
* `airflow.auth.managers.base_auth_manager.BaseAuthManager` → `airflow.api_fastapi.auth.managers.base_auth_manager.BaseAuthManager`
This reverts commit 6c27f80.
d75296e to
d631292
Compare
airflow] Update AIR301, AIR311 rules with the latest Airflow implemnetationairflow] Update AIR301 and AIR311 with the latest Airflow implementations
…rals * origin/main: [ty] Add hint that PEP 604 union syntax is only available in 3.10+ (#18192) Unify `Message` variants (#18051) [`airflow`] Update `AIR301` and `AIR311` with the latest Airflow implementations (#17985) [`airflow`] Move rules from `AIR312` to `AIR302` (#17940) [ty] Small LSP cleanups (#18201) [ty] Show related information in diagnostic (#17359) Default `src.root` to `['.', '<project_name>']` if the directory exists (#18141)
* main: [ty] Use first matching constructor overload when inferring specializations (#18204) [ty] Add hint that PEP 604 union syntax is only available in 3.10+ (#18192) Unify `Message` variants (#18051) [`airflow`] Update `AIR301` and `AIR311` with the latest Airflow implementations (#17985) [`airflow`] Move rules from `AIR312` to `AIR302` (#17940) [ty] Small LSP cleanups (#18201) [ty] Show related information in diagnostic (#17359) Default `src.root` to `['.', '<project_name>']` if the directory exists (#18141)
Summary
airflow.auth.managers.base_auth_manager.is_authorized_dataset→airflow.api_fastapi.auth.managers.base_auth_manager.is_authorized_assetairflow.providers.fab.auth_manager.fab_auth_manager.is_authorized_dataset→airflow.providers.fab.auth_manager.fab_auth_manager.is_authorized_assetairflow.models.baseoperatorlink.BaseOperatorLink→airflow.sdk.BaseOperatorLinkairflow.api_connexion.security.requires_access→ "Useairflow.api_fastapi.core_api.security.requires_access_*instead`"airflow.api_connexion.security.requires_access_dataset→airflow.api_fastapi.core_api.security.requires_access_assetairflow.notifications.basenotifier.BaseNotifier→airflow.sdk.bases.notifier.BaseNotifierairflow.www.auth.has_access→ Noneairflow.www.auth.has_access_dataset→ Noneairflow.www.utils.get_sensitive_variables_fields→ Noneairflow.www.utils.should_hide_value_for_key→ Noneairflow..sensors.weekday.DayOfWeekSensoruse_task_execution_dayremovedairflow.providers.amazon.aws.auth_manager.aws_auth_manager.AwsAuthManageris_authorized_datasetairflow.auth.managers.base_auth_manager.BaseAuthManager|airflow.providers.fab.auth_manager.fab_auth_manager.FabAuthManagerairflow.auth.managers.base_auth_manager.BaseAuthManager→airflow.api_fastapi.auth.managers.base_auth_manager.BaseAuthManager*is_authorized_dataset→is_authorized_assetTest Plan
The test fixtures have been revised and updated.