potiuk commented on a change in pull request #20848:
URL: https://github.com/apache/airflow/pull/20848#discussion_r791788521



##########
File path: dev/breeze/src/airflow_breeze/breeze.py
##########
@@ -276,6 +281,22 @@ def change_config(python, backend, cheatsheet, asciiart):
         console.print(f'[blue]Backend cached_value {backend}')
 
 
+@option_verbose
+@main.command(name="static-check")
+@click.option('-t', '--type', type=click.Choice(PRE_COMMIT_LIST), 
multiple=True)
+def static_check(verbose: bool, type: Tuple[str]):
+    if check_package_installed('pre_commit'):
+        command_to_execute = ['pre-commit', 'run']
+        for single_check in type:
+            command_to_execute.append(single_check)
+        command_to_execute.append(EXTRA_STATIC_CHECK_OPTIONS)
+        output = run_command(

Review comment:
       I think we can pass `--filles` as `boolean` flag (without any argument) 
and then add `--files` we can simply pass transparently all remaining "unknown" 
arguments "as_is". 
   
   This will be a little cheating but it should work.... So if we run:
   
   ```
   Breeze2 static-check mypy --files tests/*
   ```
   
   The run command would look like:
   
   `pre-commit run mypy --files tests/__init_.py tests/always ....`
   
   So the only difference will be that `--files` will be "known" to 
auto-complete and users will get explanation about it :) - but we will not 
expect and value after it

##########
File path: dev/breeze/src/airflow_breeze/breeze.py
##########
@@ -276,6 +281,22 @@ def change_config(python, backend, cheatsheet, asciiart):
         console.print(f'[blue]Backend cached_value {backend}')
 
 
+@option_verbose
+@main.command(name="static-check")
+@click.option('-t', '--type', type=click.Choice(PRE_COMMIT_LIST), 
multiple=True)
+def static_check(verbose: bool, type: Tuple[str]):
+    if check_package_installed('pre_commit'):
+        command_to_execute = ['pre-commit', 'run']
+        for single_check in type:
+            command_to_execute.append(single_check)
+        command_to_execute.append(EXTRA_STATIC_CHECK_OPTIONS)
+        output = run_command(

Review comment:
       I think we can pass `--filles` as `boolean` flag (without any argument) 
and then add `--files` to `pre-commit run` command and then we can simply pass 
transparently all remaining "unknown" arguments "as_is". 
   
   This will be a little cheating but it should work.... So if we run:
   
   ```
   Breeze2 static-check mypy --files tests/*
   ```
   
   The run command would look like:
   
   `pre-commit run mypy --files tests/__init_.py tests/always ....`
   
   So the only difference will be that `--files` will be "known" to 
auto-complete and users will get explanation about it :) - but we will not 
expect and value after it

##########
File path: dev/breeze/src/airflow_breeze/breeze.py
##########
@@ -276,6 +281,22 @@ def change_config(python, backend, cheatsheet, asciiart):
         console.print(f'[blue]Backend cached_value {backend}')
 
 
+@option_verbose
+@main.command(name="static-check")
+@click.option('-t', '--type', type=click.Choice(PRE_COMMIT_LIST), 
multiple=True)
+def static_check(verbose: bool, type: Tuple[str]):
+    if check_package_installed('pre_commit'):
+        command_to_execute = ['pre-commit', 'run']
+        for single_check in type:
+            command_to_execute.append(single_check)
+        command_to_execute.append(EXTRA_STATIC_CHECK_OPTIONS)
+        output = run_command(

Review comment:
       I think we can pass `--filles` as `boolean` flag (without any argument) 
and then (if present) we shoudl add `--files` to `pre-commit run` command and 
then we can simply pass transparently all remaining "unknown" arguments 
"as_is". 
   
   This will be a little cheating but it should work.... So if we run:
   
   ```
   Breeze2 static-check mypy --files tests/*
   ```
   
   The run command would look like:
   
   `pre-commit run mypy --files tests/__init_.py tests/always ....`
   
   So the only difference will be that `--files` will be "known" to 
auto-complete and users will get explanation about it :) - but we will not 
expect and value after it

##########
File path: dev/breeze/src/airflow_breeze/breeze.py
##########
@@ -276,6 +281,22 @@ def change_config(python, backend, cheatsheet, asciiart):
         console.print(f'[blue]Backend cached_value {backend}')
 
 
+@option_verbose
+@main.command(name="static-check")
+@click.option('-t', '--type', type=click.Choice(PRE_COMMIT_LIST), 
multiple=True)
+def static_check(verbose: bool, type: Tuple[str]):
+    if check_package_installed('pre_commit'):
+        command_to_execute = ['pre-commit', 'run']
+        for single_check in type:
+            command_to_execute.append(single_check)
+        command_to_execute.append(EXTRA_STATIC_CHECK_OPTIONS)
+        output = run_command(

Review comment:
       This is a bit of cheating, but I think it will do the job :).

##########
File path: dev/breeze/src/airflow_breeze/breeze.py
##########
@@ -276,6 +281,22 @@ def change_config(python, backend, cheatsheet, asciiart):
         console.print(f'[blue]Backend cached_value {backend}')
 
 
+@option_verbose
+@main.command(name="static-check")
+@click.option('-t', '--type', type=click.Choice(PRE_COMMIT_LIST), 
multiple=True)
+def static_check(verbose: bool, type: Tuple[str]):
+    if check_package_installed('pre_commit'):
+        command_to_execute = ['pre-commit', 'run']
+        for single_check in type:
+            command_to_execute.append(single_check)
+        command_to_execute.append(EXTRA_STATIC_CHECK_OPTIONS)
+        output = run_command(

Review comment:
       I think we can pass `--files` as `boolean` flag (without any argument) 
and then (if present) we shoudl add `--files` to `pre-commit run` command and 
then we can simply pass transparently all remaining "unknown" arguments 
"as_is". 
   
   This will be a little cheating but it should work.... So if we run:
   
   ```
   Breeze2 static-check mypy --files tests/*
   ```
   
   The run command would look like:
   
   `pre-commit run mypy --files tests/__init_.py tests/always ....`
   
   So the only difference will be that `--files` will be "known" to 
auto-complete and users will get explanation about it :) - but we will not 
expect and value after it

##########
File path: dev/breeze/src/airflow_breeze/breeze.py
##########
@@ -276,6 +281,22 @@ def change_config(python, backend, cheatsheet, asciiart):
         console.print(f'[blue]Backend cached_value {backend}')
 
 
+@option_verbose
+@main.command(name="static-check")
+@click.option('-t', '--type', type=click.Choice(PRE_COMMIT_LIST), 
multiple=True)
+def static_check(verbose: bool, type: Tuple[str]):
+    if check_package_installed('pre_commit'):
+        command_to_execute = ['pre-commit', 'run']
+        for single_check in type:
+            command_to_execute.append(single_check)
+        command_to_execute.append(EXTRA_STATIC_CHECK_OPTIONS)
+        output = run_command(

Review comment:
       I think we can pass `--files` as `boolean` flag (without any argument) 
and then (if present) we shoudl add `--files` to `pre-commit run` command and 
then we can simply pass transparently all remaining "unknown" arguments "as_is" 
(we should do it anyway). 
   
   This will be a little cheating but it should work.... So if we run:
   
   ```
   Breeze2 static-check mypy --files tests/*
   ```
   
   The run command would look like:
   
   `pre-commit run mypy --files tests/__init_.py tests/always ....`
   
   So the only difference will be that `--files` will be "known" to 
auto-complete and users will get explanation about it :) - but we will not 
expect and value after it




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