Skip to content

Commit af6ccfc

Browse files
author
Anis
authored
Merge pull request #30 from lumapps/chore/jira/pattern
fix(jira): the jira pattern
2 parents fd09d88 + 1808fbb commit af6ccfc

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

validator.sh

+5-4
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ readonly HEADER_PATTERN="^([^\(]+)\(([^\)]+)\): (.+)$"
88
readonly TYPE_PATTERN="^(feat|fix|docs|gen|lint|refactor|test|chore)$"
99
readonly SCOPE_PATTERN="^([a-z][a-z0-9]*)(-[a-z0-9]+)*$"
1010
readonly SUBJECT_PATTERN="^([a-z0-9].*[^ ^\.])$"
11-
readonly JIRA_PATTERN="^([A-Z]{2,6}[0-9]{0,6}-[0-9]{1,6} ?)+$"
12-
readonly JIRA_HEADER_PATTERN="^.*([A-Z]{3,4}-[0-9]{1,6}).*$"
11+
readonly JIRA_PATTERN="[A-Z]{2,6}[0-9]{0,6}-[0-9]{1,6}"
12+
readonly JIRA_FOOTER_PATTERN="^(${JIRA_PATTERN} ?)+$"
13+
readonly JIRA_HEADER_PATTERN="^.*[^A-Z](${JIRA_PATTERN}).*$"
1314
readonly BROKE_PATTERN="^BROKEN:$"
1415
readonly TRAILING_SPACE_PATTERN=" +$"
1516
readonly REVERT_HEADER_PATTERN="^[R|r]evert[: ].*$"
@@ -77,7 +78,7 @@ validate_overall_structure() {
7778

7879
if [[ $LINE =~ $BROKE_PATTERN ]]; then
7980
STATE="$READING_FOOTER"
80-
elif [[ $LINE =~ $JIRA_PATTERN ]]; then
81+
elif [[ $LINE =~ $JIRA_FOOTER_PATTERN ]]; then
8182
STATE="$READING_BROKEN"
8283
GLOBAL_JIRA=${BASH_REMATCH[0]}
8384
else
@@ -91,7 +92,7 @@ validate_overall_structure() {
9192
exit $ERROR_STRUCTURE
9293
fi
9394

94-
if [[ $LINE =~ $JIRA_PATTERN ]]; then
95+
if [[ $LINE =~ $JIRA_FOOTER_PATTERN ]]; then
9596
echo -e "missing empty line before JIRA reference"
9697
exit $ERROR_STRUCTURE
9798
fi

0 commit comments

Comments
 (0)