diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000000..8d3247d1315 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,33 @@ +--- +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v6.0.0 + hooks: + - id: trailing-whitespace + - id: mixed-line-ending + args: ['--fix', 'lf'] + exclude: '.*\.(svg)$' + - id: fix-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)$ + exclude: 'rally-jobs/cinder.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/hacking + rev: 7.0.0 + hooks: + - id: hacking + additional_dependencies: [] + exclude: '^(doc|releasenotes|tools)/.*$' + - repo: https://github.com/PyCQA/doc8 + rev: v2.0.0 + hooks: + - id: doc8 diff --git a/releasenotes/notes/bug-2103742-fix-fail-resize-nfs-volumes-with-snapshots-e861d69b1ae6f97d.yaml b/releasenotes/notes/bug-2103742-fix-fail-resize-nfs-volumes-with-snapshots-e861d69b1ae6f97d.yaml index 24edba95685..3ab9284795d 100644 --- a/releasenotes/notes/bug-2103742-fix-fail-resize-nfs-volumes-with-snapshots-e861d69b1ae6f97d.yaml +++ b/releasenotes/notes/bug-2103742-fix-fail-resize-nfs-volumes-with-snapshots-e861d69b1ae6f97d.yaml @@ -2,6 +2,6 @@ fixes: - | NFS driver `bug #2103742 - `_: Fixed issue - preventing the volume resize operation from properly updating the NFS + `_: Fixed issue + preventing the volume resize operation from properly updating the NFS image virtual size with the new size when volume has snapshots. diff --git a/tools/check_exec.py b/tools/check_exec.py deleted file mode 100755 index 7fe59fb4310..00000000000 --- a/tools/check_exec.py +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/python3 -# -# 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. - -# Print a list and return with error if any executable files are found. -# Compatible with both python 2 and 3. - -import os.path -import stat -import sys - -if len(sys.argv) < 2: - print("Usage: %s " % sys.argv[0]) - sys.exit(1) - -directories = sys.argv[1:] - -executable = [] - -for d in directories: - for root, mydir, myfile in os.walk(d): - for f in myfile: - path = os.path.join(root, f) - mode = os.lstat(path).st_mode - if stat.S_IXUSR & mode: - executable.append(path) - -if executable: - print("Executable files found:") - for f in executable: - print(f) - - sys.exit(1) diff --git a/tox.ini b/tox.ini index 0be58d297bd..ed186579c98 100644 --- a/tox.ini +++ b/tox.ini @@ -86,11 +86,13 @@ setenv = allowlist_externals = {toxinidir}/tools/config/check_uptodate.sh {toxinidir}/tools/check_exec.py +deps = + -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt + pre-commit commands = - flake8 {posargs} . - doc8 + pre-commit run --all-files --show-diff-on-failure {toxinidir}/tools/config/check_uptodate.sh - {toxinidir}/tools/check_exec.py {toxinidir}/cinder {toxinidir}/doc/source/ {toxinidir}/releasenotes/notes [testenv:fast8] install_command = {[testenv:py3]install_command}