potiuk commented on code in PR #33423:
URL: https://github.com/apache/airflow/pull/33423#discussion_r1295480275


##########
airflow/cli/cli_parser.py:
##########
@@ -65,6 +65,22 @@
 
 ALL_COMMANDS_DICT: dict[str, CLICommand] = {sp.name: sp for sp in 
airflow_commands}
 
+# Check if sub-commands are defined twice, which could be an issue.
+if len(ALL_COMMANDS_DICT) < len(airflow_commands):
+    seen = set()
+    dup = []
+    for command in airflow_commands:
+        if command.name not in seen:
+            seen.add(command.name)
+        else:
+            dup.append(command.name)
+    log.warning(
+        "The following CLI %d command(s) are defined more than once, "
+        "CLI behavior when using those will be unpredictable: %s",
+        len(dup),
+        dup,
+    )

Review Comment:
   Opinion: I actually like the compact way better :). I learned to appreciate 
some of the itertools/collections shorthands, this one looks pretty readable.
   
   IMHO. I think for the compactness of some of the comprehensions and 
shorthands like that, the optimisation should be for readability, not "length" 
(I recall the programming competitiions in writing something as short as 
possible, usually those winners were also winning the "least readable" code 
competition as well). But this one is both more compact and pretty readable as 
well.



-- 
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.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

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

Reply via email to