File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,38 @@ Revisions are considered frozen when a _hex object name_ is used. That is a hash
47
47
48
48
The rules `u` and `f` cannot be enabled together.
49
49
50
+ # # Alternatives
51
+
52
+ You can also implement rules `f`, `u`, `m`, `e` with a more lightweight and faster pygrep hook.
53
+ That is a simple check against a regular expression :
54
+
55
+ <!-- prettier-ignore-start -->
56
+ ` ` ` yaml
57
+ - repo: local
58
+ hooks:
59
+ - id: rev-frozen
60
+ name: revs must be frozen
61
+ entry: "\\ brev: (?!['\" ]?[a-f0-9]{40})"
62
+ language: pygrep
63
+ files: '\. pre-commit-config.yaml'
64
+ - id: rev-frozen-comment
65
+ name: frozen revs must have a corresponding comment
66
+ entry: "\\ brev: (['\" ]?)[a-f0-9]{40}\\ 1(?!\\ s*# frozen: \\ S+)"
67
+ language: pygrep
68
+ files: '\. pre-commit-config.yaml'
69
+ - id: rev-unfrozen
70
+ name: revs may not be frozen
71
+ entry: "\\ brev: ['\" ]?[a-f0-9]{40}"
72
+ language: pygrep
73
+ files: '\. pre-commit-config.yaml'
74
+ - id: rev-unfrozen-comment
75
+ name: unfrozen revs may not have a contradicting comment
76
+ entry: "\\ brev: (?!(['\" ]?)[a-f0-9]{40}\\ 1).*\\ s*# frozen:"
77
+ language: pygrep
78
+ files: '\. pre-commit-config.yaml'
79
+ ` ` `
80
+ <!-- prettier-ignore-end -->
81
+
50
82
# # Versioning
51
83
52
84
In adherence to [semver](https://semver.org/) the following rules determine compatibility between different versions of this hook.
You can’t perform that action at this time.
0 commit comments