pre-commit: Bump dependencies

We also switch to the native hacking plugin and rework tox to (a) avoid
installing unnecessary dependencies when calling pre-commit in the pep8
testenv and (b) actually install the package, since skip_sdist means
different things in tox 4.

Change-Id: I2f217b08ab2dd87416a3ce24c08be771333752cd
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane
2025-09-12 11:13:09 +01:00
parent 68a4a3314a
commit fc383fa0dc
4 changed files with 12 additions and 40 deletions

View File

@@ -1,39 +1,20 @@
# We from the Oslo project decided to pin repos based on the
# commit hash instead of the version tag to prevend arbitrary
# code from running in developer's machines. To update to a
# newer version, run `pre-commit autoupdate` and then replace
# the newer versions with their commit hash.
default_language_version:
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 9136088a246768144165fcc3ecc3d31bb686920a # v3.3.0
rev: v6.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: fix-byte-order-marker
- 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: local
- repo: https://opendev.org/openstack/hacking
rev: 7.0.0
hooks:
- id: flake8
name: flake8
additional_dependencies:
- hacking>=3.0.1,<3.1.0
language: python
entry: flake8
files: '^.*\.py$'
- id: hacking
additional_dependencies: []
exclude: '^(doc|releasenotes|tools)/.*$'

View File

@@ -1,6 +1,2 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
docutils>=0.11 # OSI-Approved Open Source, Public Domain
pbr>=2.0 # Apache-2.0

View File

@@ -1,7 +1,5 @@
hacking>=3.0,<3.1.0 # Apache-2.0
coverage>=4.0,!=4.4 # Apache-2.0
ddt>=1.0.1 # MIT
sphinx>=2.0.0,!=2.1.0 # BSD
testtools>=1.4.0 # MIT
pre-commit>=2.6.0 # MIT
stestr>=2.0.0 # Apache-2.0

15
tox.ini
View File

@@ -1,15 +1,8 @@
[tox]
minversion = 3.1.1
minversion = 4.6.0
envlist = py3,pep8
skipsdist = true
# Automatic envs (pyXX) will only use the python version appropriate to that
# env and ignore basepython inherited from [testenv] if we set
# ignore_basepython_conflict.
ignore_basepython_conflict = true
[testenv]
basepython = python3
usedevelop = true
setenv =
LANGUAGE=en_US
LC_ALL=en_US.utf-8
@@ -26,7 +19,11 @@ commands =
stestr slowest
[testenv:pep8]
commands = pre-commit run -a
skip_install = true
deps =
pre-commit
commands =
pre-commit run --all-files --show-diff-on-failure
[testenv:venv]
commands = {posargs}