Skip to content

Commit ca118a1

Browse files
committed
fix(jira): allow jira ref with shorter prefix
1 parent d4e4973 commit ca118a1

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

validator.bats

+7-2
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ plop"
112112
@test "structure: valid commit message with header and multiple JIRA" {
113113
COMMIT="plop plop
114114
115-
ABC-1234 DEF-1234"
115+
ABC-1234 DE-1234"
116116

117117
validate_overall_structure "$COMMIT"
118118
[[ $GLOBAL_HEADER == "plop plop" ]]
119119
[[ $GLOBAL_BODY == "" ]]
120-
[[ $GLOBAL_JIRA == "ABC-1234 DEF-1234" ]]
120+
[[ $GLOBAL_JIRA == "ABC-1234 DE-1234" ]]
121121
[[ $GLOBAL_FOOTER == "" ]]
122122
}
123123

@@ -549,6 +549,11 @@ LUM-2345'
549549
[[ "$status" -eq 0 ]]
550550
}
551551

552+
@test "feat with short jira ref should be validated" {
553+
run validate_jira "feat" "AB-123"
554+
[[ "$status" -eq 0 ]]
555+
}
556+
552557
@test "overall validation invalid structure" {
553558
MESSAGE='plop
554559
plop'

validator.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ 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]{3,4}-[0-9]{1,6} ?)+$"
11+
readonly JIRA_PATTERN="^([A-Z]{2,4}-[0-9]{1,6} ?)+$"
1212
readonly JIRA_HEADER_PATTERN="^.*([A-Z]{3,4}-[0-9]{1,6}).*$"
1313
readonly BROKE_PATTERN="^BROKEN:$"
1414
readonly TRAILING_SPACE_PATTERN=" +$"

0 commit comments

Comments
 (0)