Add pre-commit hooks

This currently checks commit messages and editorconfig.
This commit is contained in:
Simon Bruder 2023-11-12 20:42:54 +01:00
parent da7003a2f2
commit adb486bbb9
Signed by: simon
GPG key ID: 8D3C82F9F309F8EC
4 changed files with 61 additions and 0 deletions

18
.gitlint Normal file
View file

@ -0,0 +1,18 @@
[general]
regex-style-search=true
contrib=contrib-allowed-authors
ignore=body-is-missing
# While they should be ≤72, 80 is the limit
[title-max-length]
line-length=80
# Every message must start with an upper case letter
[title-match-regex]
regex=^[A-Z]
[ignore-by-title]
regex=^(amend|fixup|squash).*
ignore=title-max-length
[contrib-allowed-authors]

29
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,29 @@
default_install_hook_types:
- commit-msg
- post-commit
- pre-commit
repos:
- repo: https://github.com/jorisroovers/gitlint
rev: v0.19.1
hooks:
- id: gitlint
name: Lint git commit message
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: 2.7.3
hooks:
- id: editorconfig-checker
alias: ec
- repo: local
hooks:
- id: gitlint-author
name: Check commit author
description: This hook checks the commit author after the commit (without rejecting)
entry: gitlint
language: system
pass_filenames: false
always_run: true
stages:
- post-commit

7
AUTHORS.txt Normal file
View file

@ -0,0 +1,7 @@
Denis Natusch <denis.natusch@mailbox.tu-dresden.de>
Eren Asker <eren.asker@mailbox.tu-dresden.de>
Erik Hohlfeld <erik.hohlfeld@mailbox.tu-dresden.de>
Mathis Kral <mathis_tiberius.kral@mailbox.tu-dresden.de>
Paul Heimer <heimerp54@gmail.com>
Simon Bruder <simon.bruder@mailbox.tu-dresden.de>
Theo Reichert <theo.reichert@mailbox.tu-dresden.de>

View file

@ -3,8 +3,15 @@ with pkgs;
mkShell {
buildInputs = [
asciidoctor
editorconfig-checker
gitlint
jdk17
plantuml
pre-commit
watchexec # enables automatic compiling on change
];
shellHook = ''
pre-commit install
'';
}