Files
cyborg/.pre-commit-config.yaml
Sean Mooney 8eb3a5a4b2 Migrate to ruff-format + ruff lint; drop hacking plugin
Replace autopep8 with ruff-format in pre-commit. Add G and LOG
rule-sets to ruff lint so logging-format violations (e.g. G003
string concatenation in log calls) are caught without hacking.
Add external = ["H"] so ruff recognises H-codes in noqa comments.
Add [tool.ruff.format] with quote-style = "preserve" to avoid
mass quote conversion on first run (oslo.utils pattern).

Remove the local cyborg/hacking/ plugin (M310/M322/M336/M340
checks) and its test file; register only the upstream hacking
package (rev 8.0.0) via pre-commit. Simplify [flake8] to
select = H only, matching oslo.utils. Remove [flake8:local-plugins].

Drop bandit: remove tox bandit env, cyborg-tox-bandit Zuul job
and its check reference, and bandit from test-requirements.txt.
Hacking is also removed from test-requirements.txt; it is now
consumed solely via the pre-commit hook.

Rewrite tox pep8 env to run `pre-commit run -a` (oslo.utils
pattern); remove fast8 env and tools/flake8wrap.sh. Remove
autopep8 mention from HACKING.rst.

Apply ruff-format to all 214 reformatted source files as part
of this migration commit.

Generated-By: claude-code sonnet 4.6
Change-Id: Id70f611dd571e156264838d4054ff62577028671
Signed-off-by: Sean Mooney <work@seanmooney.info>
2026-03-05 16:26:50 +00:00

60 lines
1.6 KiB
YAML

---
default_language_version:
# force all unspecified python hooks to run python3
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
# whitespace
- id: trailing-whitespace
- id: mixed-line-ending
args: ['--fix', 'lf']
exclude: '.*\.(svg)$'
- id: fix-byte-order-marker
# file format and permissions
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: check-yaml
files: .*\.(yaml|yml)$
- id: check-json
files: .*\.json$
exclude: .*-curl.*\.json$
- id: check-ast
# git
- id: check-added-large-files
- id: check-case-conflict
- id: detect-private-key
- id: check-merge-conflict
exclude: '.*\.(rst|inc)$'
# python
- id: debug-statements
- id: check-docstring-first
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.1
hooks:
- id: ruff-check
args: ['--fix', '--unsafe-fixes']
- id: ruff-format
- repo: https://opendev.org/openstack/hacking
rev: 8.0.0
hooks:
- id: hacking
additional_dependencies: []
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
args: ['--ignore-words=doc/dictionary.txt']
- repo: https://github.com/sphinx-contrib/sphinx-lint
rev: v1.0.0
hooks:
- id: sphinx-lint
args: [--enable=default-role]
files: ^doc/|^releasenotes/|^api-guide/
types: [rst]
- repo: https://github.com/PyCQA/doc8
rev: v1.1.2
hooks:
- id: doc8