Run pre-commit in the Xtesting gates 17/73917/3
authorCédric Ollivier <cedric.ollivier@orange.com>
Fri, 17 Mar 2023 13:59:24 +0000 (14:59 +0100)
committerCédric Ollivier <cedric.ollivier@orange.com>
Mon, 20 Mar 2023 08:53:10 +0000 (09:53 +0100)
Change-Id: I691d0982b8e8f70afce622950c6b27a47e2bb417
Co-authored-by: Guillaume Lambert <guillaume.lambert@orange.com>
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
.pre-commit-config.yaml [new file with mode: 0644]
test-requirements.txt
tox.ini
upper-constraints.txt

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644 (file)
index 0000000..a2e0d4c
--- /dev/null
@@ -0,0 +1,14 @@
+---
+repos:
+  - repo: https://github.com/pre-commit/pre-commit-hooks
+    rev: v4.4.0
+    hooks:
+      - id: trailing-whitespace
+        exclude: '.patch$'
+        # trailing blanks shall not preferably be fixed in patch files
+  - repo: https://github.com/Lucas-C/pre-commit-hooks
+    rev: v1.4.2
+    hooks:
+      - id: remove-tabs
+        stages: [commit]
+        exclude: '^(.git/|docs/make.bat|docs/Makefile|)'
index a539958..4be1d67 100644 (file)
@@ -16,3 +16,4 @@ bashate # Apache-2.0
 ansible-lint[core]
 bandit
 munch # MIT
+pre-commit
diff --git a/tox.ini b/tox.ini
index dac846a..3af21a1 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
 [tox]
-envlist = docs,pep8,pylint,yamllint,bashate,py310,cover,perm
+envlist = docs,pep8,pylint,yamllint,bashate,py310,cover,perm,pre-commit
 skipsdist = True
 
 [testenv]
@@ -74,3 +74,8 @@ commands =
     -exec ls -l \{\} + | grep '.' && exit 1 || exit 0"
   bash -c "\
     find {[testenv:perm]path} -exec file \{\} + | grep CRLF && exit 1 || exit 0"
+
+[testenv:pre-commit]
+basepython = python3.10
+commands =
+    pre-commit run --all-files --show-diff-on-failure
index 613a971..59d9f4d 100644 (file)
@@ -8,3 +8,4 @@ ansible-lint===5.2.1
 pytest===7.1.2
 pytest-cov===3.0.0
 pytest-html===3.1.1
+pre-commit===3.1.1