Introduce pre-commit hooks for linters verifications

Change-Id: Icd098df8adf72bf53955b0f07d9ed606c7803296
This commit is contained in:
Federico Ressi 2020-07-02 15:46:42 +02:00
parent 39cfc87676
commit 5252001658
10 changed files with 46 additions and 16 deletions

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

@ -0,0 +1,30 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.1.0
hooks:
- id: check-added-large-files
- id: check-byte-order-marker
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
- id: detect-private-key
- id: end-of-file-fixer
- id: forbid-new-submodules
- id: requirements-txt-fixer
args: [requirements.txt, test-requirements.txt, extra-requirements.txt, linters-requirements.txt, doc/requirements.txt, infrared_plugin/requirements.txt]
- id: trailing-whitespace
# - repo: https://github.com/adrienverge/yamllint.git
# rev: v1.23.0
# hooks:
# - id: yamllint
# files: \.(yaml|yml)$
# - repo: https://opendev.org/openstack/bashate.git
# rev: 2.0.0
# hooks:
# - id: bashate

View File

@ -173,4 +173,3 @@
defend, and hold each Contributor harmless for any liability defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability. of your accepting any such warranty or additional liability.

1
Vagrantfile vendored
View File

@ -121,4 +121,3 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
end end
end end

View File

@ -2,15 +2,14 @@
# of appearance. Changing the order has an impact on the overall integration # of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later. # process, which may cause wedges in the gate later.
oslotest>=3.2.0 # Apache-2.0
oslo.log>=3.36.0 # Apache-2.0
reno>=2.5.0 # Apache-2.0
sphinx!=1.6.6,!=1.6.7,>=1.6.2,<2.0.0;python_version=='2.7' # BSD
sphinx!=1.6.6,!=1.6.7,>=1.6.2;python_version>='3.4' # BSD
sphinx_rtd_theme>=0.4.2,< 1 # Apache-2.0
# As openstack job build-reno-releasenotes and Read The Docs page support only # As openstack job build-reno-releasenotes and Read The Docs page support only
# one single requirements file for a project, we need to have one such file # one single requirements file for a project, we need to have one such file
# which will include all project requirements # which will include all project requirements
-r ../requirements.txt -r ../requirements.txt
-r ../extra-requirements.txt -r ../extra-requirements.txt
oslo.log>=3.36.0 # Apache-2.0
oslotest>=3.2.0 # Apache-2.0
reno>=2.5.0 # Apache-2.0
sphinx!=1.6.6,!=1.6.7,>=1.6.2,<2.0.0;python_version=='2.7' # BSD
sphinx!=1.6.6,!=1.6.7,>=1.6.2;python_version>='3.4' # BSD
sphinx_rtd_theme>=0.4.2,< 1 # Apache-2.0

View File

@ -4,4 +4,5 @@ ansible-lint==4.2.0 # MIT
flake8>=3.8.1 # MIT flake8>=3.8.1 # MIT
flake8-import-order==0.12 # LGPLv3 flake8-import-order==0.12 # LGPLv3
mypy>=0.740 # MIT mypy>=0.740 # MIT
pre-commit >= 2.6.0 # MIT
pylint>=2.5.2 # GPLv2 pylint>=2.5.2 # GPLv2

View File

@ -26,4 +26,3 @@ six==1.11.0
sshtunnel==0.1.5 sshtunnel==0.1.5
stestr==3.0.0 stestr==3.0.0
testtools==2.2.0 testtools==2.2.0

View File

@ -2,9 +2,9 @@
docker>=4.0.0 # Apache-2.0 docker>=4.0.0 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD fixtures>=3.0.0 # Apache-2.0/BSD
keystoneauth1>=3.18.0 # Apache-2.0
Jinja2>=2.10.0 # BSD Jinja2>=2.10.0 # BSD
junitxml>=0.7.0 # MIT junitxml>=0.7.0 # MIT
keystoneauth1>=3.18.0 # Apache-2.0
netaddr>=0.7.18 # BSD netaddr>=0.7.18 # BSD
neutron-lib>=1.25.0 # Apache-2.0 neutron-lib>=1.25.0 # Apache-2.0
oslo.config>=5.2.0 # Apache-2.0 oslo.config>=5.2.0 # Apache-2.0
@ -12,13 +12,13 @@ oslo.log>=3.36.0 # Apache-2.0
paramiko>=2.4.0 # LGPLv2.1 paramiko>=2.4.0 # LGPLv2.1
pbr>=4.0.4 # Apache-2.0 pbr>=4.0.4 # Apache-2.0
podman>=1.6.0 # Apache-2.0 podman>=1.6.0 # Apache-2.0
python-heatclient>=1.5.0 # Apache-2.0
python-glanceclient>=2.16.0 # Apache-2.0 python-glanceclient>=2.16.0 # Apache-2.0
python-heatclient>=1.5.0 # Apache-2.0
python-neutronclient>=6.7.0 # Apache-2.0 python-neutronclient>=6.7.0 # Apache-2.0
python-novaclient>=9.1.0 # Apache-2.0 python-novaclient>=9.1.0 # Apache-2.0
python-octaviaclient>=1.9.0 # Apache-2.0 python-octaviaclient>=1.9.0 # Apache-2.0
python-openstackclient>=3.12.0 # Apache-2.0 python-openstackclient>=3.12.0 # Apache-2.0
stestr>=2.0.0 # Apache-2.0
six>=1.11.0 # MIT six>=1.11.0 # MIT
sshtunnel>=0.1.5.0 # MIT sshtunnel>=0.1.5.0 # MIT
stestr>=2.0.0 # Apache-2.0
testtools>=2.2.0 # MIT testtools>=2.2.0 # MIT

View File

@ -65,4 +65,3 @@ test_collect_dir: '{{ test_src_dir | realpath }}/{{ test_report_name }}'
upper_constraints_file: upper_constraints_file:
'https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt' 'https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt'

View File

@ -95,6 +95,10 @@ whitelist_externals = bash
deps = {[testenv:pep8]deps} deps = {[testenv:pep8]deps}
envdir = {toxworkdir}/pep8 envdir = {toxworkdir}/pep8
commands = commands =
pre-commit --version
pre-commit autoupdate
pre-commit run --all-files
pre-commit install
{[testenv:pep8]commands} {[testenv:pep8]commands}
mypy --ignore-missing-imports tobiko/ mypy --ignore-missing-imports tobiko/
# Ansible lint # Ansible lint
@ -230,7 +234,7 @@ commands =
basepython = {[testenv:py3]basepython} basepython = {[testenv:py3]basepython}
envdir = {toxworkdir}/docs envdir = {toxworkdir}/docs
deps = deps =
{[testenv]deps} {env:TOX_CONSTRAINTS}
-r{toxinidir}/doc/requirements.txt -r{toxinidir}/doc/requirements.txt