aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2023-03-20 10:58:28 +0100
committerCédric Ollivier <cedric.ollivier@orange.com>2023-03-20 11:00:41 +0100
commit2078edf93db9a1fddb877fd0ebde020e6c59976e (patch)
tree9d488b2240a5805ecff5fddddbd377831fd73fc3
parent321200df0e7da1fa2e0f20ce4458b5731fb93323 (diff)
Run pre-commit in the Functest K8s gates
Change-Id: I3957dbde922d8ed8edc47d5cf1aee1475f117836 Co-authored-by: Guillaume Lambert <guillaume.lambert@orange.com> Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com> (cherry picked from commit 8bd1c09890c7c1fff392572de709a0ccc6a283b6)
-rw-r--r--.pre-commit-config.yaml14
-rw-r--r--test-requirements.txt1
-rw-r--r--tox.ini5
3 files changed, 20 insertions, 0 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 00000000..a2e0d4c6
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -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|)'
diff --git a/test-requirements.txt b/test-requirements.txt
index 04a0312e..fd3f01c4 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -12,3 +12,4 @@ yamllint
ansible-lint
bashate # Apache-2.0
bandit
+pre-commit
diff --git a/tox.ini b/tox.ini
index ac898d93..313ef2b6 100644
--- a/tox.ini
+++ b/tox.ini
@@ -56,3 +56,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