diff --git a/STATIC_CODE_CHECKS.rst b/STATIC_CODE_CHECKS.rst index 791b86b71f710..71f132e7d5d10 100644 --- a/STATIC_CODE_CHECKS.rst +++ b/STATIC_CODE_CHECKS.rst @@ -399,13 +399,13 @@ Run the ``flake8`` check for the ``tests.core.py`` file with verbose output: .. code-block:: bash - breeze static-check --type run-flake8 --files tests/core.py --verbose + breeze static-check --type run-flake8 --file tests/core.py --verbose Run the ``flake8`` check for the ``tests.core`` package with verbose output: .. code-block:: bash - breeze static-check --type run-flake8 --files tests/core/* --verbose + breeze static-check --type run-flake8 --file tests/core/* --verbose Run all tests for the currently staged files: diff --git a/dev/breeze/src/airflow_breeze/commands/developer_commands.py b/dev/breeze/src/airflow_breeze/commands/developer_commands.py index 30c02688e029c..bb1d974e7ce9e 100644 --- a/dev/breeze/src/airflow_breeze/commands/developer_commands.py +++ b/dev/breeze/src/airflow_breeze/commands/developer_commands.py @@ -17,7 +17,7 @@ import os import sys -from typing import Optional, Tuple +from typing import Iterable, Optional, Tuple import rich_click as click @@ -199,7 +199,7 @@ "name": "Pre-commit flags", "options": [ "--type", - "--files", + "--file", "--all-files", "--show-diff-on-failure", "--last-commit", @@ -438,8 +438,8 @@ def build_docs( type=BetterChoice(PRE_COMMIT_LIST), multiple=True, ) -@click.option('-a', '--all-files', help="Run checks on all files.", is_flag=True) -@click.option('-f', '--files', help="List of files to run the checks on.", multiple=True) +@click.option('-a', '--all-files', help="Run checks on all files.") +@click.option('-f', '--file', help="List of files to run the checks on.", type=click.Path(), multiple=True) @click.option( '-s', '--show-diff-on-failure', help="Show diff for files modified by the checks.", is_flag=True ) @@ -469,7 +469,7 @@ def static_checks( last_commit: bool, commit_ref: str, type: Tuple[str], - files: bool, + file: Iterable[str], precommit_args: Tuple, ): assert_pre_commit_installed(verbose=verbose) @@ -488,10 +488,11 @@ def static_checks( command_to_execute.extend(["--from-ref", "HEAD^", "--to-ref", "HEAD"]) if commit_ref: command_to_execute.extend(["--from-ref", f"{commit_ref}^", "--to-ref", f"{commit_ref}"]) - if files: - command_to_execute.append("--files") if verbose or dry_run: command_to_execute.append("--verbose") + if file: + command_to_execute.append("--files") + command_to_execute.extend(file) if precommit_args: command_to_execute.extend(precommit_args) env = os.environ.copy() diff --git a/images/breeze/output-commands-hash.txt b/images/breeze/output-commands-hash.txt index 8520b2c3bd921..8a3bf0f004ed8 100644 --- a/images/breeze/output-commands-hash.txt +++ b/images/breeze/output-commands-hash.txt @@ -1 +1 @@ -43bc980dd30f21c6979990470870a936 +e275b745e83c5e5f4fc2a54677ab7e0d diff --git a/images/breeze/output-static-checks.svg b/images/breeze/output-static-checks.svg index a5bdbd201b478..d9188e5fe8863 100644 --- a/images/breeze/output-static-checks.svg +++ b/images/breeze/output-static-checks.svg @@ -19,85 +19,85 @@ font-weight: 700; } - .terminal-73501607-matrix { + .terminal-2026671122-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 26.400000000000002px; font-variant-east-asian: full-width; } - .terminal-73501607-title { + .terminal-2026671122-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-73501607-r1 { fill: #c5c8c6;font-weight: bold } -.terminal-73501607-r2 { fill: #c5c8c6 } -.terminal-73501607-r3 { fill: #d0b344;font-weight: bold } -.terminal-73501607-r4 { fill: #868887 } -.terminal-73501607-r5 { fill: #68a0b3;font-weight: bold } -.terminal-73501607-r6 { fill: #98a84b;font-weight: bold } -.terminal-73501607-r7 { fill: #8d7b39 } + .terminal-2026671122-r1 { fill: #c5c8c6;font-weight: bold } +.terminal-2026671122-r2 { fill: #c5c8c6 } +.terminal-2026671122-r3 { fill: #d0b344;font-weight: bold } +.terminal-2026671122-r4 { fill: #868887 } +.terminal-2026671122-r5 { fill: #68a0b3;font-weight: bold } +.terminal-2026671122-r6 { fill: #98a84b;font-weight: bold } +.terminal-2026671122-r7 { fill: #8d7b39 } - Command: static-checks + Command: static-checks -                                                                                                                          - Usage: breeze static-checks [OPTIONS] [PRECOMMIT_ARGS]...                                                               -                                                                                                                         - Run static checks.                                                                                                      -                                                                                                                         -╭─ Pre-commit flags ───────────────────────────────────────────────────────────────────────────────────────────────────╮ -  --type                  -t  Type(s) of the static checks to run (multiple can be added).                             -                              (all | black | blacken-docs | check-airflow-2-1-compatibility |                          -                              check-airflow-config-yaml-consistent | check-airflow-providers-have-extras |             -                              check-apache-license-rat | check-base-operator-usage |                                   -                              check-boring-cyborg-configuration | check-breeze-top-dependencies-limited |              -                              check-builtin-literals | check-changelog-has-no-duplicates |                             -                              check-daysago-import-from-utils | check-docstring-param-types |                          -                              check-executables-have-shebangs | check-extra-packages-references | check-extras-order   -                              | check-for-inclusive-language | check-hooks-apply |                                     -                              check-incorrect-use-of-LoggingMixin | check-integrations-are-consistent |                -                              check-merge-conflict | check-newsfragments-are-valid |                                   -                              check-no-providers-in-core-examples | check-no-relative-imports |                        -                              check-persist-credentials-disabled-in-github-workflows |                                 -                              check-pre-commit-information-consistent | check-provide-create-sessions-imports |        -                              check-provider-yaml-valid | check-providers-init-file-missing |                          -                              check-providers-subpackages-init-file-exist | check-pydevd-left-in-code |                -                              check-revision-heads-map | check-safe-filter-usage-in-html | check-setup-order |         -                              check-start-date-not-used-in-defaults | check-system-tests-present | check-xml |         -                              codespell | debug-statements | detect-private-key | doctoc | end-of-file-fixer |         -                              fix-encoding-pragma | flynt | forbid-tabs | identity | insert-license | isort |          -                              lint-chart-schema | lint-css | lint-dockerfile | lint-helm-chart | lint-javascript |     -                              lint-json-schema | lint-markdown | lint-openapi | mixed-line-ending |                    -                              pretty-format-json | pydocstyle | python-no-log-warn | pyupgrade | rst-backticks |       -                              run-flake8 | run-mypy | run-shellcheck | static-check-autoflake | trailing-whitespace    -                              | update-breeze-file | update-breeze-readme-config-hash | update-extras |                -                              update-in-the-wild-to-be-sorted | update-inlined-dockerfile-scripts |                    -                              update-local-yml-file | update-migration-references | update-providers-dependencies |    -                              update-setup-cfg-file | update-spelling-wordlist-to-be-sorted |                          -                              update-supported-versions | update-vendored-in-k8s-json-schema | update-version |        -                              yamllint | yesqa)                                                                        -  --files                 -f  List of files to run the checks on. (TEXT)                                               -  --all-files             -a  Run checks on all files.                                                                 -  --show-diff-on-failure  -s  Show diff for files modified by the checks.                                              -  --last-commit           -c  Run checks for all files in last commit. Mutually exclusive with --commit-ref.           -╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ -╭─ Options ────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ -  --commit-ref         -r  Run checks for this commit reference only (can be any git commit-ish reference). Mutually   -                           exclusive with --last-commit.                                                               -                           (TEXT)                                                                                      -  --verbose            -v  Print verbose information about performed steps.                                            -  --dry-run            -D  If dry-run is set, commands are only printed, not executed.                                 -  --github-repository  -g  GitHub repository used to pull, push run images. (TEXT) [default: apache/airflow]           -  --help               -h  Show this message and exit.                                                                 -╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +                                                                                                                          + Usage: breeze static-checks [OPTIONS] [PRECOMMIT_ARGS]...                                                               +                                                                                                                         + Run static checks.                                                                                                      +                                                                                                                         +╭─ Pre-commit flags ───────────────────────────────────────────────────────────────────────────────────────────────────╮ +  --type                  -t  Type(s) of the static checks to run (multiple can be added).                             +                              (all | black | blacken-docs | check-airflow-2-1-compatibility |                          +                              check-airflow-config-yaml-consistent | check-airflow-providers-have-extras |             +                              check-apache-license-rat | check-base-operator-usage |                                   +                              check-boring-cyborg-configuration | check-breeze-top-dependencies-limited |              +                              check-builtin-literals | check-changelog-has-no-duplicates |                             +                              check-daysago-import-from-utils | check-docstring-param-types |                          +                              check-executables-have-shebangs | check-extra-packages-references | check-extras-order   +                              | check-for-inclusive-language | check-hooks-apply |                                     +                              check-incorrect-use-of-LoggingMixin | check-integrations-are-consistent |                +                              check-merge-conflict | check-newsfragments-are-valid |                                   +                              check-no-providers-in-core-examples | check-no-relative-imports |                        +                              check-persist-credentials-disabled-in-github-workflows |                                 +                              check-pre-commit-information-consistent | check-provide-create-sessions-imports |        +                              check-provider-yaml-valid | check-providers-init-file-missing |                          +                              check-providers-subpackages-init-file-exist | check-pydevd-left-in-code |                +                              check-revision-heads-map | check-safe-filter-usage-in-html | check-setup-order |         +                              check-start-date-not-used-in-defaults | check-system-tests-present | check-xml |         +                              codespell | debug-statements | detect-private-key | doctoc | end-of-file-fixer |         +                              fix-encoding-pragma | flynt | forbid-tabs | identity | insert-license | isort |          +                              lint-chart-schema | lint-css | lint-dockerfile | lint-helm-chart | lint-javascript |     +                              lint-json-schema | lint-markdown | lint-openapi | mixed-line-ending |                    +                              pretty-format-json | pydocstyle | python-no-log-warn | pyupgrade | rst-backticks |       +                              run-flake8 | run-mypy | run-shellcheck | static-check-autoflake | trailing-whitespace    +                              | update-breeze-file | update-breeze-readme-config-hash | update-extras |                +                              update-in-the-wild-to-be-sorted | update-inlined-dockerfile-scripts |                    +                              update-local-yml-file | update-migration-references | update-providers-dependencies |    +                              update-setup-cfg-file | update-spelling-wordlist-to-be-sorted |                          +                              update-supported-versions | update-vendored-in-k8s-json-schema | update-version |        +                              yamllint | yesqa)                                                                        +  --file                  -f  List of files to run the checks on. (PATH)                                               +  --all-files             -a  Run checks on all files. (TEXT)                                                          +  --show-diff-on-failure  -s  Show diff for files modified by the checks.                                              +  --last-commit           -c  Run checks for all files in last commit. Mutually exclusive with --commit-ref.           +╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭─ Options ────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +  --commit-ref         -r  Run checks for this commit reference only (can be any git commit-ish reference). Mutually   +                           exclusive with --last-commit.                                                               +                           (TEXT)                                                                                      +  --verbose            -v  Print verbose information about performed steps.                                            +  --dry-run            -D  If dry-run is set, commands are only printed, not executed.                                 +  --github-repository  -g  GitHub repository used to pull, push run images. (TEXT) [default: apache/airflow]           +  --help               -h  Show this message and exit.                                                                 +╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯