Skip to content

Commit 883ba4d

Browse files
feat: Change perl regex to extended regex
1 parent 2f49dee commit 883ba4d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

conventional-pre-commit.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ msg_file=$1
2121
# join types with | to form regex ORs
2222
r_types="($(IFS='|'; echo "${types[*]}"))"
2323
# optional (scope)
24-
r_scope="(\([\w \/-]+\))?"
24+
r_scope="(\([[:alnum:] \/-]+\))?"
2525
# optional breaking change indicator and colon delimiter
2626
r_delim='!?:'
2727
# subject line, body, footer
28-
r_subject=" [\w][\s\S]+"
28+
r_subject=" [[:alnum:]].+"
2929
# the full regex pattern
3030
pattern="^$r_types$r_scope$r_delim$r_subject$"
3131

32-
# check commit message
33-
if grep -Pq "$pattern" "$msg_file"; then
32+
# Check if commit is conventional commit
33+
if grep -Eq "$pattern" "$msg_file"; then
3434
exit 0
3535
fi
3636

0 commit comments

Comments
 (0)