Update pre-commit and tox configuration 39/103239/1
authorguillaume.lambert <guillaume.lambert@orange.com>
Wed, 16 Nov 2022 13:03:15 +0000 (14:03 +0100)
committerguillaume.lambert <guillaume.lambert@orange.com>
Wed, 16 Nov 2022 13:06:19 +0000 (14:06 +0100)
- update pre-commit repo revision
- use new gitlint-ci pre-commit profile
  https://github.com/jorisroovers/gitlint/pull/192
- update pre-commit configuration accordingly
  especially remove gitlint profile from envlist
  since it is now supersed by gitlint-ci pre-commit profile

Signed-off-by: guillaume.lambert <guillaume.lambert@orange.com>
Change-Id: I0984526059a4f869099c32f22909618fd294c549

.pre-commit-config.yaml
tox.ini

index baa871ba7c4d9103d8dd1ce8d6492a577144e5c3..e2513a9137ec63ec05c175b762b977a714621703 100644 (file)
@@ -1,27 +1,29 @@
 ---
 repos:
   - repo: https://github.com/pre-commit/pre-commit-hooks
-    rev: v4.0.1
+    rev: v4.3.0
     hooks:
       - id: trailing-whitespace
         exclude: '^ordmodels/'
         # ordmodels trailing blanks shall preferably be fixed in OpenROADM upstream repo
 
   - repo: https://github.com/jorisroovers/gitlint
-    rev: v0.16.0
+    rev: v0.18.0
     hooks:
       - id: gitlint
         stages: [commit-msg]
+      - id: gitlint-ci
+        stages: [manual]
 
   - repo: https://github.com/Lucas-C/pre-commit-hooks
-    rev: v1.1.10
+    rev: v1.3.1
     hooks:
       - id: remove-tabs
         stages: [commit]
         exclude: '^(.git/|docs/make.bat|docs/Makefile|ordmodels/)'
 
   - repo: https://github.com/pre-commit/mirrors-autopep8
-    rev: v1.5.7
+    rev: v2.0.0
     hooks:
       - id: autopep8
         args: ['--in-place', '--max-line-length=120']
diff --git a/tox.ini b/tox.ini
index 3baf8b2587b76abeaa1b543df217d39e08e8d237..ae81c10416737807053fd853bd81a1412324486d 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -9,7 +9,6 @@ envlist = buildcontroller,testsPCE,
     docs-linkcheck
     checkbashisms
     pre-commit
-    gitlint
     pylint
 skipsdist = true
 setupdir = tests/
@@ -310,12 +309,7 @@ deps = pre-commit
 passenv = HOME
 commands =
     pre-commit run --all-files --show-diff-on-failure
-    pre-commit run gitlint --hook-stage commit-msg --commit-msg-filename .git/COMMIT_EDITMSG
-    # Gitlint only proposes a pre-commit configuration for the commit-msg stage but none for the commit stage.
-    # Its default arguments --passed and --msg-filename are different from CI recommandations.
-    # As a result, the line above is always skipped in jenkins CI since there cannot be a .git/COMMIT_EDITMSG file.
-    # A dedicated gitlint profile for CI is proposed below. Also to behave fine locally, this profile must have access
-    # to the HOME variable so that Gitlint can retrieve Git user settings.
+    pre-commit run gitlint-ci --hook-stage manual
 
 [testenv:gitlint]
 basepython = python3