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

Switch from Black to Ruff formatter #35287

Merged
merged 10 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 7 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,6 @@ repos:
- --fuzzy-match-generates-todo
files: >
\.cfg$|\.conf$|\.ini$|\.ldif$|\.properties$|\.readthedocs$|\.service$|\.tf$|Dockerfile.*$
- repo: https://github.com/psf/black
rev: 23.10.0
hooks:
- id: black
name: Run black (Python formatter)
args: [--config=./pyproject.toml]
exclude: ^.*/.*_vendor/|^airflow/contrib/
- repo: local
hooks:
- id: update-common-sql-api-stubs
Expand All @@ -181,13 +174,16 @@ repos:
pass_filenames: false
require_serial: true
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.292
rev: v0.1.3
hooks:
# Since ruff makes use of multiple cores we _purposefully_ don't run this in docker so it can use the
# host CPU to it's fullest
- id: ruff
name: ruff
args: [ --fix ]
name: ruff-lint
args: [--fix]
exclude: ^.*/.*_vendor/|^tests/dags/test_imports.py
- id: ruff-format
name: ruff-format
exclude: ^.*/.*_vendor/|^tests/dags/test_imports.py
jlaneve marked this conversation as resolved.
Show resolved Hide resolved
- repo: https://github.com/asottile/blacken-docs
rev: 1.16.0
Expand All @@ -200,7 +196,7 @@ repos:
- --target-version=py38
- --target-version=py39
- --target-version=py310
alias: black
alias: blacken-docs
additional_dependencies: [black==23.10.0]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
Expand Down
6 changes: 3 additions & 3 deletions STATIC_CODE_CHECKS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@ require Breeze Docker image to be built locally.
+-----------------------------------------------------------+--------------------------------------------------------------+---------+
| ID | Description | Image |
+===========================================================+==============================================================+=========+
| black | Run black (Python formatter) | |
+-----------------------------------------------------------+--------------------------------------------------------------+---------+
| blacken-docs | Run black on Python code blocks in documentation files | |
+-----------------------------------------------------------+--------------------------------------------------------------+---------+
| check-aiobotocore-optional | Check if aiobotocore is an optional dependency only | |
Expand Down Expand Up @@ -319,7 +317,9 @@ require Breeze Docker image to be built locally.
+-----------------------------------------------------------+--------------------------------------------------------------+---------+
| rst-backticks | Check if RST files use double backticks for code | |
+-----------------------------------------------------------+--------------------------------------------------------------+---------+
| ruff | ruff | |
| ruff | ruff-lint | |
+-----------------------------------------------------------+--------------------------------------------------------------+---------+
| ruff-format | ruff-format | |
+-----------------------------------------------------------+--------------------------------------------------------------+---------+
| shellcheck | Check Shell scripts syntax correctness | |
+-----------------------------------------------------------+--------------------------------------------------------------+---------+
Expand Down
2 changes: 1 addition & 1 deletion airflow/api/common/delete_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def delete_dag(dag_id: str, keep_records_in_log: bool = True, session: Session =
)
)

dags_to_delete = [dag_id for dag_id, in dags_to_delete_query]
dags_to_delete = [dag_id for (dag_id,) in dags_to_delete_query]
kaxil marked this conversation as resolved.
Show resolved Hide resolved

# Scheduler removes DAGs without files from serialized_dag table every dag_dir_list_interval.
# There may be a lag, so explicitly removes serialized DAG here.
Expand Down