ashb commented on a change in pull request #12657:
URL: https://github.com/apache/airflow/pull/12657#discussion_r531779661



##########
File path: airflow/upgrade/checker.py
##########
@@ -45,19 +46,44 @@ def register_arguments(subparser):
         "-s", "--save",
         help="Saves the result to the indicated file. The file format is 
determined by the file extension."
     )
+    subparser.add_argument(
+        "-i", "--ignore",
+        help="Ignore a rule. Can be used multiple times.",
+        action='append',
+    )
+    subparser.add_argument(
+        "-c", "--config",
+        help="Path to upgrade check config yaml file.",
+    )
     subparser.set_defaults(func=run)
 
 
 def run(args):
     from airflow.upgrade.formatters import (ConsoleFormatter, JSONFormatter)
+    from airflow.upgrade.config import UpgradeConfig
+
     if args.save:
         filename = args.save
         if not filename.lower().endswith(".json"):
             exit("Only JSON files are supported")
         formatter = JSONFormatter(args.save)
     else:
         formatter = ConsoleFormatter()
-    all_problems = check_upgrade(formatter)
+
+    if args.ignore:
+        rules = [r for r in ALL_RULES if r.__class__.__name__ not in 
args.ignore]
+    else:
+        rules = ALL_RULES
+
+    if args.config:
+        print("Using config file from:", args.config)
+        upgrade_config = UpgradeConfig.read(path=args.config)
+        rules = upgrade_config.register_custom_rules(rules)
+        rules = upgrade_config.remove_ignored_rules(rules)

Review comment:
       How about you make `remove_ignored_rules` a function in here, and then 
it can be used for both `args.ignore` and the value from the config file.




----------------------------------------------------------------
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:
[email protected]


Reply via email to