From 23f8a606240feafd9b29db32f1cdbb060469c0ed Mon Sep 17 00:00:00 2001 From: Dominik Loidolt <dominik.loidolt@univie.ac.at> Date: Tue, 12 Nov 2024 13:20:03 +0100 Subject: [PATCH] Add pre-commit configuration file This commit introduces a pre-commit configuration file (.pre-commit-config.yaml) to ensure code quality and consistency by automatically running various checks and fixes before commits are finalized. Quick start =========== 1. Install pre-commit Before you can run hooks, you need to have the pre-commit package manager installed. Using pip: pip install pre-commit 2. Install the git hook scripts run: pre-commit install to set up the git hook scripts Now pre-commit will run automatically on git commit! 3. (optional) Run against all the files It's usually a good idea to run the hooks against all of the files when adding new hooks (usually pre-commit will only run on the changed files during git hooks): pre-commit run --all-files For more information see https://pre-commit.com --- .pre-commit-config.yaml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..deaf686 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,31 @@ +repos: + - repo: 'https://github.com/pre-commit/pre-commit-hooks' + rev: v5.0.0 + hooks: + - id: trailing-whitespace + args: + - '--markdown-linebreak-ext=md' + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files + - id: check-case-conflict + - repo: 'https://github.com/codespell-project/codespell' + rev: v2.3.0 + hooks: + - id: codespell + - repo: 'https://github.com/jorisroovers/gitlint' + rev: v0.19.1 + hooks: + - id: gitlint + - repo: 'https://github.com/dloidolt/pre-commit-checkpatch' + rev: v0.1.0 + hooks: + - id: checkpatch-files + args: + - '--fix-inplace' + - '--show-types' + - '--ignore=SPDX_LICENSE_TAG,PREFER_DEFINED_ATTRIBUTE_MACRO,INLINE' + - repo: 'https://github.com/bbastin/pre-commit-meson.git' + rev: v1.0.0 + hooks: + - id: meson-test -- GitLab