Merge "Use pre-commit to run pep8 checks"

This commit is contained in:
Zuul
2025-05-12 16:07:56 +00:00
committed by Gerrit Code Review
9 changed files with 102 additions and 63 deletions

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

@@ -0,0 +1,29 @@
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: []
- repo: https://github.com/PyCQA/doc8
rev: v1.1.2
hooks:
- id: doc8

View File

@@ -1,3 +1,16 @@
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Ceilometer documentation build configuration file, created by
# sphinx-quickstart on Thu Oct 27 11:38:59 2011.
@@ -11,8 +24,8 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys
import os
import sys
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.abspath(os.path.join(BASE_DIR, "..", ".."))
@@ -41,8 +54,8 @@ extensions = [
'oslo_config.sphinxconfiggen',
]
config_generator_config_file = os.path.join(ROOT,
'etc/ceilometer/ceilometer-config-generator.conf')
config_generator_config_file = os.path.join(
ROOT, 'etc/ceilometer/ceilometer-config-generator.conf')
sample_config_basename = '_static/ceilometer'
todo_include_todos = True

View File

@@ -33,14 +33,11 @@ commands =
coverage xml -o cover/coverage.xml
[testenv:pep8]
skip_install = true
deps =
hacking>=6.1.0,<6.2.0
doc8
pre-commit
commands =
flake8
doc8 {posargs}
# Check that .po and .pot files are valid:
bash -c "find ceilometer -type f -regex '.*\.pot?' -print0|xargs -0 -n 1 msgfmt --check-format -o /dev/null"
pre-commit run -a
[testenv:releasenotes]
deps =