From bc561b9b85083dbfde0fd371590af2aa4dbe6362 Mon Sep 17 00:00:00 2001
From: Amir MOHAMMADI <amir.mohammadi@idiap.ch>
Date: Thu, 25 Mar 2021 14:34:21 +0100
Subject: [PATCH] Run pre-commit checks

---
 bob/devtools/scripts/ci.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/bob/devtools/scripts/ci.py b/bob/devtools/scripts/ci.py
index 6eaa9a0b..6d51c233 100644
--- a/bob/devtools/scripts/ci.py
+++ b/bob/devtools/scripts/ci.py
@@ -1013,3 +1013,11 @@ def check(root):
             "pyproject.toml file not found in the root folder of the package. "
             "See https://gitlab.idiap.ch/bob/bob/-/wikis/ci-checks#pyprojecttoml"
         )
+
+    # if there is a pre-commit file, run the tests
+    path = os.path.join(root, ".pre-commit-config.yaml")
+    if os.path.isfile(path):
+        from ..bootstrap import run_cmdline
+
+        run_cmdline(["pip", "install", "pre-commit"])
+        run_cmdline(["pre-commit", "run", "--all-files"])
-- 
GitLab