diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..e5a746a7 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,36 @@ +--- +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: trailing-whitespace + - id: mixed-line-ending + args: ['--fix', 'lf'] + exclude: | + (?x)( + .*.svg$| + ) + - id: fix-byte-order-marker + - id: check-merge-conflict + - id: debug-statements + - id: check-json + files: .*\.json$ + - id: check-yaml + files: .*\.(yaml|yml)$ + exclude: releasenotes/.*$ + - repo: https://github.com/Lucas-C/pre-commit-hooks + rev: v1.5.4 + hooks: + - id: remove-tabs + exclude: '.*\.(svg)$' + - repo: https://github.com/sphinx-contrib/sphinx-lint + rev: v1.0.0 + hooks: + - id: sphinx-lint + args: [--enable=default-role] + files: ^doc/|releasenotes|api-ref + - repo: https://github.com/PyCQA/doc8 + rev: v1.1.2 + hooks: + - id: doc8 + diff --git a/test-requirements.txt b/test-requirements.txt index 66afba2c..9dcb184d 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -2,7 +2,6 @@ # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -doc8 # Apache-2.0 stestr!=2.3.1 # Apache-2.0 testtools>=0.9.34 diff --git a/tox.ini b/tox.ini index 6ccdbf34..4692ecd1 100644 --- a/tox.ini +++ b/tox.ini @@ -5,15 +5,17 @@ skipsdist = true [testenv] usedevelop = True +allowlist_externals = pre-commit setenv = VIRTUAL_ENV={envdir} deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt + pre-commit commands = stestr run {posargs} - doc8 priorities/ specs/ doc/source README.rst + pre-commit run --all-files --show-diff-on-failure {posargs} [testenv:venv] commands = {posargs:}