Add .pre-commit-config.yaml
authorSimon Marchi <simon.marchi@efficios.com>
Fri, 30 Aug 2024 19:32:33 +0000 (15:32 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 9 Oct 2024 02:56:57 +0000 (22:56 -0400)
This can help catch problems a bit earlier than in the CI.

To use it, a developer would run `pre-commit` in the source repository.
This installs git commit hooks that will run the checks described by
`.pre-commit-config.yaml` on the modified files.

It is possible to run the checks on all files with:

    $ pre-commit run --all-files
    black....................................................................Passed
    flake8...................................................................Passed
    isort....................................................................Passed

Change-Id: I695f0b0f2fea3adadae132ceb708928db3217e0c
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13202
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
.pre-commit-config.yaml [new file with mode: 0644]

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644 (file)
index 0000000..a4d944f
--- /dev/null
@@ -0,0 +1,21 @@
+# SPDX-License-Identifier: MIT
+#
+# Copyright (C) 2024 EfficiOS, Inc.
+#
+
+repos:
+  - repo: https://github.com/psf/black-pre-commit-mirror
+    rev: 23.12.1
+    hooks:
+      - id: black
+        exclude: '(tests/utils/python/normand.py|tests/utils/python/tap/.*|tests/utils/python/typing/.*)'
+  - repo:  https://github.com/pycqa/flake8
+    rev: 7.1.1
+    hooks:
+      - id: flake8
+        exclude: '(tests/utils/python/normand.py|tests/utils/python/tap/.*|tests/utils/python/typing/.*)'
+  - repo: https://github.com/pycqa/isort
+    rev: 5.13.2
+    hooks:
+      - id: isort
+        exclude: '(tests/utils/python/normand.py|tests/utils/python/tap/.*|tests/utils/python/typing/.*)'
This page took 0.024495 seconds and 4 git commands to generate.