3
3
# documentation can be found at https://pre-commit.com/
4
4
#
5
5
# 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
9
7
#
10
8
# if you want to trigger pre-commit manually:
11
9
# pre-commit run
10
+ # pre-commit run --all-files
12
11
#
13
12
repos :
14
13
- repo : https://github.com/pre-commit/pre-commit-hooks
15
14
rev : v2.3.0
16
15
hooks :
16
+ - id : check-merge-conflict
17
+ args : [--assume-in-merge]
18
+ - id : check-json
19
+ - id : check-toml
17
20
- id : check-yaml
18
21
- id : end-of-file-fixer
19
22
- id : trailing-whitespace
@@ -40,3 +43,31 @@ repos:
40
43
rev : 7.0.0
41
44
hooks :
42
45
- 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