mirror of
https://github.com/ansible/awx.git
synced 2026-10-31 14:36:17 -02:30
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:
co-authored by
Claude Opus 4.6
parent
b84931a49b
commit
4b73e1264b
@@ -26,10 +26,8 @@ def run(stdout=sys.stdout, stderr=sys.stderr, argv=[]):
|
||||
sys.exit(1)
|
||||
except ConnectionError as e:
|
||||
cli.parser.print_help()
|
||||
msg = (
|
||||
'\nThere was a network error of some kind trying to reach '
|
||||
'{}.\nYou might need to specify (or double-check) '
|
||||
'--conf.host'.format(cli.get_config('host'))
|
||||
msg = '\nThere was a network error of some kind trying to reach {}.\nYou might need to specify (or double-check) --conf.host'.format(
|
||||
cli.get_config('host')
|
||||
)
|
||||
if isinstance(e, SSLError):
|
||||
msg = (
|
||||
@@ -60,7 +58,7 @@ def run(stdout=sys.stdout, stderr=sys.stderr, argv=[]):
|
||||
sys.stdout.write(e.__class__.__name__)
|
||||
print('')
|
||||
sys.exit(1)
|
||||
except Exception as e:
|
||||
except Exception as e: # noqa: F841
|
||||
if cli.verbose:
|
||||
e = traceback.format_exc()
|
||||
cprint(e, 'red', file=stderr)
|
||||
|
||||
+2
-7
@@ -26,11 +26,9 @@ commands =
|
||||
[testenv:lint]
|
||||
deps =
|
||||
{[testenv]deps}
|
||||
flake8
|
||||
ruff
|
||||
commands =
|
||||
flake8 awxkit
|
||||
# pylama --report report.pylama awxkit
|
||||
# py.test awxkit --pylama --junitxml=report.pylama {posargs}
|
||||
ruff check awxkit
|
||||
- coverage erase
|
||||
|
||||
[testenv:coveralls]
|
||||
@@ -39,9 +37,6 @@ commands=
|
||||
- coverage report -m
|
||||
- coveralls
|
||||
|
||||
[flake8]
|
||||
max-line-length = 120
|
||||
|
||||
[pytest]
|
||||
addopts = -v --tb=native
|
||||
testpaths = test
|
||||
|
||||
Reference in New Issue
Block a user