File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -261,10 +261,16 @@ repos:
261
261
hooks:
262
262
- id: commit-message-validator
263
263
stages: [commit-msg]
264
+ args: [--allow-temp]
264
265
...
265
266
` ` `
266
267
Then run `pre-commit install --hook-type commit-msg` to install the `commit-message-validator`
267
268
269
+ # ## OPTIONS
270
+
271
+ - if `no_jira` is set, no validation is done on JIRA refs.
272
+ - if `allow_temp` is set, no validation is done on `fixup!` and `squash!` commits.
273
+
268
274
<!-- ROADMAP -->
269
275
270
276
# # Roadmap
Original file line number Diff line number Diff line change 2
2
3
3
set -eu
4
4
5
+ OPTIONS=$( getopt --long no-jira allow-temp -- " $@ " )
6
+ [ $? -eq 0 ] || {
7
+ echo " Incorrect options provided"
8
+ exit 1
9
+ }
10
+
11
+ COMMIT_VALIDATOR_ALLOW_TEMP=
12
+ COMMIT_VALIDATOR_NO_JIRA=
13
+
14
+ while true ; do
15
+ case " $1 " in
16
+ --no-jira ) COMMIT_VALIDATOR_NO_JIRA=1; shift ;;
17
+ --allow-temp ) COMMIT_VALIDATOR_ALLOW_TEMP=1; shift ;;
18
+ -- ) shift ; break ;;
19
+ * ) break ;;
20
+ esac
21
+ done
22
+
5
23
DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " > /dev/null 2>&1 && pwd ) "
6
24
# shellcheck source=validator.sh
7
25
source " $DIR /validator.sh"
25
43
26
44
# print message so you don't lose it in case of errors
27
45
# (in case you are not using `-m` option)
46
+ echo " Options: JIRA=$COMMIT_VALIDATOR_NO_JIRA , TEMP=$COMMIT_VALIDATOR_ALLOW_TEMP "
28
47
printf " checking commit message:\n\n#BEGIN#\n%s\n#END#\n\n" " $( grep -v " #" <<< " $MESSAGE" ) "
29
48
30
- COMMIT_VALIDATOR_ALLOW_TEMP=1 COMMIT_VALIDATOR_NO_JIRA=1 validate " $MESSAGE "
49
+ validate " $MESSAGE "
You can’t perform that action at this time.
0 commit comments