Files
neutron/.pre-commit-config.yaml
Stephen Finucane fad3b6f8bc pre-commit: Use local neutron hacking checks
This patch requires a new neutron-lib release (3.21.1) containing
the depends on one.

Change-Id: I880dc9e7f0d3cd578168e5c1435275901fc68f1f
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Depends-On: https://review.opendev.org/c/openstack/neutron-lib/+/956353
2025-09-09 12:33:24 +00:00

114 lines
3.7 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: v5.0.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-yaml
files: .*\.(yaml|yml)$
exclude: 'rally-jobs/task-neutron.yaml'
- repo: https://github.com/lucas-c/pre-commit-hooks
rev: v1.5.5
hooks:
- id: remove-tabs
exclude: '.*\.(svg)$'
- repo: https://opendev.org/openstack/bashate.git
rev: 2.1.1
hooks:
- id: bashate
# E005 file does not begin with #! or have a .sh prefix
# E006 check for lines longer than 79 columns
# E042 local declaration hides errors
# E043 Arithmetic compound has inconsistent return semantics
args: ['-v', '-iE006', '-iE005,E042,E043']
files: .*\.sh
exclude: '.tox/.*'
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.1
hooks:
- id: ruff-check
args: ['--fix', '--unsafe-fixes']
- repo: https://opendev.org/openstack/hacking
rev: 7.0.0
hooks:
- id: hacking
additional_dependencies: ['neutron-lib>=3.21.1']
exclude: '^(doc|releasenotes|tools)/.*$'
- repo: https://github.com/hhatto/autopep8
rev: v2.3.2
hooks:
- id: autopep8
files: '^.*\.py$'
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.16.1
hooks:
- id: mypy
pass_filenames: false
# need to list alembic here; otherwise it doesn't see internals
# necessary to detect one of 'ignored' errors and complains about
# unnecessary ignore; other dependencies can be left out it seems
additional_dependencies: ['alembic']
- repo: https://github.com/PyCQA/doc8
rev: v2.0.0
hooks:
- id: doc8
exclude: |
(?x)(
doc/source/admin/config-qos-min-pps.rst
| doc/source/admin/deploy-provider-verifynetworkoperation.txt
| doc/source/admin/deploy-selfservice-verifynetworkoperation.txt
| doc/source/admin/shared/deploy-ha-vrrp-initialnetworks.txt
| doc/source/admin/shared/deploy-ha-vrrp-verifynetworkoperation.txt
| doc/source/admin/shared/deploy-provider-initialnetworks.txt
| doc/source/configuration/metering-agent.rst
| doc/source/contributor/internals/images
| doc/source/contributor/policies/bugs.rst
)
files: |
(?x)(
doc/source/.*
| neutron/.*
| CONTRIBUTING.rst
| README.rst
| TESTING.rst
)
- repo: local
hooks:
- id: misc-sanity-checks
name: misc sanity checks
language: script
require_serial: true
pass_filenames: false
entry: './tools/misc-sanity-checks.sh'
files: '^.*\.py$'
exclude: '^(doc|releasenotes|tools)/.*$'
- repo: local
hooks:
- id: check-unit-test-structure
name: check unit test structure
language: script
require_serial: true
pass_filenames: false
entry: './tools/check_unit_test_structure.sh'
files: '^.*\.py$'
exclude: '^(doc|releasenotes|tools)/.*$'
# todo(slaweq): enable pylint check once all issues in the current code will
# be solved
# - id: pylint
# name: pylint
# entry: .tox/pep8/bin/pylint
# files: ^neutron/
# language: system
# types: [python]
# args: ['--rcfile=.pylintrc', '--output-format=colorized']