Use pre-commit to run pep8 checks

Change-Id: I930854d3304fe7b87d2393034fe54ca5d42dc0d4
This commit is contained in:
Takashi Kajinami
2025-04-14 13:12:04 +09:00
parent 3b5efdf204
commit 96afb8a580
3 changed files with 32 additions and 4 deletions

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

@@ -0,0 +1,25 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
# Replaces or checks mixed line ending
- id: mixed-line-ending
args: ['--fix', 'lf']
exclude: '.*\.(svg)$'
# Forbid files which have a UTF-8 byte-order marker
- id: check-byte-order-marker
# Checks that non-binary executables have a proper shebang
- id: check-executables-have-shebangs
# Check for files that contain merge conflict strings.
- id: check-merge-conflict
# Check for debugger imports and py37+ breakpoint()
# calls in python source
- id: debug-statements
- id: check-yaml
files: .*\.(yaml|yml)$
- repo: https://opendev.org/openstack/hacking
rev: 7.0.0
hooks:
- id: hacking
additional_dependencies: []

View File

@@ -22,7 +22,7 @@ sys.path.insert(0, os.path.abspath('../..'))
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
'sphinx.ext.autodoc',
#'sphinx.ext.intersphinx',
# 'sphinx.ext.intersphinx',
'openstackdocstheme'
]
@@ -74,7 +74,7 @@ latex_documents = [
]
# Example configuration for intersphinx: refer to the Python standard library.
#intersphinx_mapping = {'http://docs.python.org/': None}
# intersphinx_mapping = {'http://docs.python.org/': None}
# openstackdocstheme options
openstackdocs_repo_name = 'openstack/ceilometermiddleware'

View File

@@ -16,8 +16,11 @@ deps =
commands = stestr run --slowest {posargs}
[testenv:pep8]
deps = hacking>=6.1.0,<6.2.0
commands = flake8
skip_install = true
deps =
pre-commit
commands =
pre-commit run -a
[testenv:venv]
commands = {posargs}