[airflow] Update AIR301 and AIR311 with the latest Airflow implementations#17985
Merged
ntBre merged 8 commits intoastral-sh:mainfrom May 19, 2025
Merged
[airflow] Update AIR301 and AIR311 with the latest Airflow implementations#17985ntBre merged 8 commits intoastral-sh:mainfrom
airflow] Update AIR301 and AIR311 with the latest Airflow implementations#17985ntBre merged 8 commits intoastral-sh:mainfrom
Conversation
airflow] Update AIR301, AIR311 rules with the latest Airflow implemnetation
2 tasks
dedaab9 to
4e3f5ef
Compare
Contributor
|
| 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
reviewed
May 15, 2025
Contributor
ntBre
left a comment
There was a problem hiding this comment.
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( |
Contributor
There was a problem hiding this comment.
I think you're supposed to use the binding returned by get_or_import_symbol. Was something going wrong here when you did that?
Contributor
Author
There was a problem hiding this comment.
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
Contributor
There was a problem hiding this comment.
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
ntBre
approved these changes
May 19, 2025
airflow] Update AIR301, AIR311 rules with the latest Airflow implemnetationairflow] Update AIR301 and AIR311 with the latest Airflow implementations
dcreager
added a commit
that referenced
this pull request
May 19, 2025
…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)
dcreager
added a commit
that referenced
this pull request
May 19, 2025
* 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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.