File tree 2 files changed +14
-10
lines changed
2 files changed +14
-10
lines changed Original file line number Diff line number Diff line change 1
- #! /bin/bash -e
1
+ #! /usr/ bin/env bash
2
2
3
- if [[ $ZSH_NAME != " " ]]; then
3
+ set -eu
4
+
5
+ if [[ -v ZSH_NAME ]]; then
4
6
setopt BASH_REMATCH
5
7
setopt RE_MATCH_PCRE
6
8
setopt KSH_ARRAYS
Original file line number Diff line number Diff line change 1
- #! /bin/bash -e
2
-
3
- if [[ $ZSH_NAME != " " ]]; then
1
+ if [[ -v ZSH_NAME ]]; then
4
2
setopt BASH_REMATCH
5
3
setopt RE_MATCH_PCRE
6
4
setopt KSH_ARRAYS
@@ -140,9 +138,11 @@ validate_header() {
140
138
141
139
validate_header_length () {
142
140
local HEADER=" $1 "
143
- local LENGTH=` echo -n " $HEADER " | wc -c`
141
+ local LENGTH
142
+
143
+ LENGTH=" $( echo -n " $HEADER " | wc -c) "
144
144
145
- if [ $LENGTH -gt 70 ]; then
145
+ if [[ $LENGTH -gt 70 ] ]; then
146
146
echo -e " commit header length is more than 70 charaters"
147
147
exit $ERROR_HEADER_LENGTH
148
148
fi
@@ -181,9 +181,11 @@ validate_body_length() {
181
181
182
182
while IFS= read -r LINE ;
183
183
do
184
- local LENGTH=` echo -n " $LINE " | wc -c`
184
+ local LENGTH
185
+
186
+ LENGTH=" $( echo -n " $LINE " | wc -c) "
185
187
186
- if [ $LENGTH -gt 100 ]; then
188
+ if [[ $LENGTH -gt 100 ] ]; then
187
189
echo -e " body message line length is more than 100 charaters"
188
190
exit $ERROR_BODY_LENGTH
189
191
fi
@@ -222,7 +224,7 @@ validate_jira() {
222
224
local TYPE=$1
223
225
local JIRA=$2
224
226
225
- if [[ ` need_jira " $TYPE " ` -eq 1 && $JIRA = " " ]]; then
227
+ if [[ " $( need_jira " $TYPE " ) " -eq " 1 " && -z " ${JIRA :- } " ]]; then
226
228
echo -e " ${TYPE} need a jira reference"
227
229
exit $ERROR_JIRA
228
230
fi
You can’t perform that action at this time.
0 commit comments