AAP-85334: Replace Black + Flake8 with Ruff

Migrate Python linting and formatting toolchain from Black (formatter)
and Flake8 (linter) to Ruff, which provides both in a single tool.

- pyproject.toml: remove [tool.black], add [tool.ruff] config sections
- tox.ini: replace black+flake8 deps/commands with ruff in linters env
- awxkit/tox.ini: replace flake8 with ruff in lint env
- Makefile: replace `black` target with `format` + `lint`, keep `black`
  as legacy alias, update `check` and `api-lint`
- pre-commit.sh: use `ruff format --check`, honor AWX_IGNORE_RUFF
- requirements_dev.txt: swap black/flake8 for ruff
- Dockerfile.j2: install ruff instead of black
- CONTRIBUTING.md: update tool references
- Fix noqa comments to use # separator instead of ; (ruff requirement)
- Add noqa: F841 for false positive in awxkit/cli/__init__.py

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dirk Julich
2026-08-20 18:35:23 +02:00
co-authored by Claude Opus 4.6
parent b84931a49b
commit 4b73e1264b
15 changed files with 55 additions and 51 deletions
+4 -9
View File
@@ -3,22 +3,17 @@ isolated_build = True
[testenv:linters]
deps =
black
flake8
ruff
yamllint
allowlist_externals = make
setenv =
BLACK_ARGS = --check
PYTHON = python3
commands =
make black
flake8 awx awxkit awx_collection
# awx_collection is excluded: ansible-test sanity runs its own linters which conflict with ruff
ruff format --check awx awxkit
ruff check awx awxkit
yamllint -s .
[flake8]
select = F401,F402,F821,F823,F841,F811,E265,E266,F541,W605,E722,F822,F523,W291,F405
exclude = env,awx_collection_build,.tox
[testenv:pip-compile-docs]
description = Compile docs build lockfiles
deps =