You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/01/14 20:00:16 UTC

[GitHub] [airflow] SamWheating commented on a change in pull request #13622: Switch logic for rule check

SamWheating commented on a change in pull request #13622:
URL: https://github.com/apache/airflow/pull/13622#discussion_r557663565



##########
File path: airflow/upgrade/rules/import_changes.py
##########
@@ -113,7 +113,7 @@ def _check_file(file_path):
         with open(file_path, "r") as file:
             content = file.read()
             for change in ImportChangesRule.ALL_CHANGES:
-                if change.old_class in content:
+                if change.old_path in content:

Review comment:
       While the old version of this was subject to false positives, such as throwing a warning on
   `from airflow.providers.cncf.kubernetes.operators.kubernetes_pod import KubernetesPodOperator` 
   due to the match on `KubernetesPodOperator`
   
   I think that this version will produce false negatives, as we are now searching the file for the full import path (`airflow.contrib.operators.kubernetes_pod_operator.KubernetesPodOperator`)
   
   Which means that something like `from airflow.contrib.operators.kubernetes_pod_operator import KubernetesPodOperator` won't be caught as there is no exact match. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org