Skip to content
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

different-operator-varname-taskid doesn't handle a subclassed operator with a dynamic task_id #7

Open
miketheman opened this issue Aug 10, 2021 · 0 comments

Comments

@miketheman
Copy link

Example:

class AutoNameOperator(DummyOperator):
    def __init__(self, tbl_name):
        self.task_id = tbl_name.replace(".", "_")

    super().__init__(task_id=self.task_id)


eggs_spam = AutoNameOperator(tbl_name="eggs.spam")

I'd expect the evaluation of different-operator-varname-taskid to pass, however in this section:

for keyword in node.value.keywords:
if keyword.arg == "task_id" and isinstance(keyword.value, astroid.Const):
# TODO support other values than constants
task_id = keyword.value.value
continue
elif keyword.arg == "python_callable":
python_callable_name = keyword.value.name
if var_name != task_id:
self.add_message("different-operator-varname-taskid", node=node)

task_id is None, and thereby raises the message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant