Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make --file command in static-checks autocomplete file name #23896

Merged
merged 1 commit into from
May 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions STATIC_CODE_CHECKS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
15 changes: 8 additions & 7 deletions dev/breeze/src/airflow_breeze/commands/developer_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import os
import sys
from typing import Optional, Tuple
from typing import Iterable, Optional, Tuple

import rich_click as click

Expand Down Expand Up @@ -199,7 +199,7 @@
"name": "Pre-commit flags",
"options": [
"--type",
"--files",
"--file",
"--all-files",
"--show-diff-on-failure",
"--last-commit",
Expand Down Expand Up @@ -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
)
Expand Down Expand Up @@ -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)
Expand All @@ -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()
Expand Down
Loading