-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[airflow] passing positional argument into airflow.lineage.hook.HookLineageCollector.create_asset is not allowed (AIR301)
#21096
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
base: main
Are you sure you want to change the base?
Conversation
|
…e_asset has positional arguments
e224675 to
4114892
Compare
airflow] passing positional argument into airflow.lineage.hook.HookLineageCollector.create_asset is not allowed (AIR301)
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 haven't followed the airflow PRs closely so I don't know if this is the first check for positional arguments.
Did airflow 2 allow position arguments but airflow 3 does no more?
I can see how this check is useful but it's something a type checker could catch too.
| 59 | hlc.create_asset("should", "be", "no", "posarg") | ||
| 60 | hlc.create_asset(name="but", uri="kwargs are ok") | ||
| | | ||
| help: Calling ``HookLineageCollector.create_asset`` with positional argument should raise an error |
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.
Is this the intended message you want to show to users? Shouldn't it say instead that position arguments are disallowed?
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.
Let me reword it again
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.
After reading the whole message yet again, we should probably add a AIR303 for function signature change. I have another local branch working on something similar and moving this one there might be better as create_asset is not removed. Only its signature changed.
WDTY?
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.
Agree, AIR301 feels out of place for a signature change because it's not a removal
Yes, I think this is the first one
Yes.
Yes, but we think it would still be helpful if these rules can also detect it here. As most of our users would be data engineers and might not care type checking that much |
Fair enough. I'd prefer a separate rule because that would also make it easier to deprecate said rule when we introduce a general-purpose rule that detects positional arguments that should have been passed as keyword arguments (which we already have in ty) |
…e_asset has positional arguments
Summary
airflow.lineage.hook.HookLineageCollector.create_assetis not allowedTest Plan
update the test fixture accordingly and reorganize in the next commit