Integrate pre-commit

Just as we've done for Nova and many other projects.

Change-Id: I40410f637fcb1b05724a4ed7106e557c07006164
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane 2024-05-14 14:29:44 +01:00
parent 728abf5647
commit cfdaf9836a
4 changed files with 40 additions and 6 deletions

36
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,36 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: mixed-line-ending
args: ['--fix', 'lf']
exclude: '.*\.(svg)$'
- id: check-byte-order-marker
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: debug-statements
- id: check-json
files: .*\.json$
- id: check-yaml
files: .*\.(yaml|yml)$
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.5
hooks:
- id: remove-tabs
exclude: '.*\.(svg)$'
- repo: https://opendev.org/openstack/hacking
rev: 6.1.0
hooks:
- id: hacking
additional_dependencies: []
exclude: '^(doc|releasenotes|tools)/.*$'
# TODO(stephenfin): Uncomment this
# - repo: https://github.com/sphinx-contrib/sphinx-lint
# rev: v0.9.1
# hooks:
# - id: sphinx-lint
# args: [--enable=default-role]
# files: ^doc/|releasenotes|api-guide
# types: [rst]

View File

@ -107,7 +107,6 @@ tests:
status: 200
response_json_paths:
$.allocation_requests.`len`: 2
status: 200
- name: verify microversion fail for multiple member_of params
GET: /allocation_candidates?resources=VCPU:1,MEMORY_MB:1024,DISK_GB:100&member_of=$ENVIRON['AGGA_UUID']&member_of=$ENVIRON['AGGB_UUID']

View File

@ -32,10 +32,6 @@ tests:
status: 406
response_headers:
content-type: /application/json/
response_json_paths:
$.errors.[0].title: Not Acceptable
$.errors.[0].max_version: /^\d+\.\d+$/
$.errors.[0].min_version: /^\d+\.\d+$/
response_strings:
- "Unacceptable version header: 0.5"
response_json_paths:

View File

@ -36,8 +36,11 @@ commands =
[testenv:pep8]
description =
Run style checks.
skip_install = true
deps =
pre-commit
commands =
bash tools/flake8wrap.sh {posargs}
pre-commit run --all-files --show-diff-on-failure
[testenv:fast8]
description =