33# documentation can be found at https://pre-commit.com/
44#
55# perform once after cloning the repository:
6- # pipx install pre-commit
7- # pre-commit install --hook-type pre-commit
8- # pre-commit install --hook-type commit-msg
6+ # scripts/prepare_repository
97#
108# if you want to trigger pre-commit manually:
119# pre-commit run
10+ # pre-commit run --all-files
1211#
1312repos :
1413 - repo : https://github.com/pre-commit/pre-commit-hooks
1514 rev : v2.3.0
1615 hooks :
16+ - id : check-merge-conflict
17+ args : [--assume-in-merge]
18+ - id : check-json
19+ - id : check-toml
1720 - id : check-yaml
1821 - id : end-of-file-fixer
1922 - id : trailing-whitespace
@@ -40,3 +43,31 @@ repos:
4043 rev : 7.0.0
4144 hooks :
4245 - id : flake8
46+ # -----------------------------------------------------------------------
47+ # !! post-commit can't prevent the commit from happening !!
48+ #
49+ # At this point we can only complain that the commit wasn't signed
50+ # properly and provide a warning that something isn't right and remind
51+ # the user to go back and fix this specific commit.
52+ #
53+ # (We rely on the 'pre-push' stage to prevent pushing of unsigned commits.)
54+ - repo : local
55+ hooks :
56+ - id : commit-signed
57+ name : Verify commit is signed
58+ stages :
59+ - post-commit
60+ always_run : true
61+ language : system
62+ entry : git
63+ args : [ "verify-commit", "HEAD" ]
64+ # -----------------------------------------------------------------------
65+ - repo : local
66+ hooks :
67+ - id : signed-commits
68+ name : Verify signature
69+ language : script
70+ entry : scripts/verify_commits-are-signed
71+ args : [ "$PRE_COMMIT_FROM_REF", "$PRE_COMMIT_TO_REF" ]
72+ stages :
73+ - pre-push
0 commit comments