diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..aec4347cb --- /dev/null +++ b/.pre-commit-config.yaml @@ -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 diff --git a/LICENSE b/LICENSE index 68c771a09..67db85882 100644 --- a/LICENSE +++ b/LICENSE @@ -173,4 +173,3 @@ defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - diff --git a/Vagrantfile b/Vagrantfile index 63eead30d..fc40b5d30 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -121,4 +121,3 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| end end - diff --git a/doc/Makefile b/doc/Makefile index 69fe55ecf..ba501f6f5 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -16,4 +16,4 @@ help: # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/doc/requirements.txt b/doc/requirements.txt index cafff7f4a..6da350d32 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -2,15 +2,14 @@ # of appearance. Changing the order has an impact on the overall integration # 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 # one single requirements file for a project, we need to have one such file # which will include all project requirements -r ../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 diff --git a/linters-requirements.txt b/linters-requirements.txt index 8945dab89..0a1b5fff2 100644 --- a/linters-requirements.txt +++ b/linters-requirements.txt @@ -4,4 +4,5 @@ ansible-lint==4.2.0 # MIT flake8>=3.8.1 # MIT flake8-import-order==0.12 # LGPLv3 mypy>=0.740 # MIT +pre-commit >= 2.6.0 # MIT pylint>=2.5.2 # GPLv2 diff --git a/lower-constraints.txt b/lower-constraints.txt index 0ccb7ceac..70210d90e 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -26,4 +26,3 @@ six==1.11.0 sshtunnel==0.1.5 stestr==3.0.0 testtools==2.2.0 - diff --git a/requirements.txt b/requirements.txt index ba3575731..672b74c33 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,9 +2,9 @@ docker>=4.0.0 # Apache-2.0 fixtures>=3.0.0 # Apache-2.0/BSD -keystoneauth1>=3.18.0 # Apache-2.0 Jinja2>=2.10.0 # BSD junitxml>=0.7.0 # MIT +keystoneauth1>=3.18.0 # Apache-2.0 netaddr>=0.7.18 # BSD neutron-lib>=1.25.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 pbr>=4.0.4 # 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-heatclient>=1.5.0 # Apache-2.0 python-neutronclient>=6.7.0 # Apache-2.0 python-novaclient>=9.1.0 # Apache-2.0 python-octaviaclient>=1.9.0 # Apache-2.0 python-openstackclient>=3.12.0 # Apache-2.0 -stestr>=2.0.0 # Apache-2.0 six>=1.11.0 # MIT sshtunnel>=0.1.5.0 # MIT +stestr>=2.0.0 # Apache-2.0 testtools>=2.2.0 # MIT diff --git a/roles/tobiko-common/defaults/main.yaml b/roles/tobiko-common/defaults/main.yaml index 1378cb119..ac6891a65 100644 --- a/roles/tobiko-common/defaults/main.yaml +++ b/roles/tobiko-common/defaults/main.yaml @@ -65,4 +65,3 @@ test_collect_dir: '{{ test_src_dir | realpath }}/{{ test_report_name }}' upper_constraints_file: 'https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt' - diff --git a/tox.ini b/tox.ini index 1aef5163c..fc288ecf1 100644 --- a/tox.ini +++ b/tox.ini @@ -95,6 +95,10 @@ whitelist_externals = bash deps = {[testenv:pep8]deps} envdir = {toxworkdir}/pep8 commands = + pre-commit --version + pre-commit autoupdate + pre-commit run --all-files + pre-commit install {[testenv:pep8]commands} mypy --ignore-missing-imports tobiko/ # Ansible lint @@ -230,7 +234,7 @@ commands = basepython = {[testenv:py3]basepython} envdir = {toxworkdir}/docs deps = - {[testenv]deps} + {env:TOX_CONSTRAINTS} -r{toxinidir}/doc/requirements.txt