Skip to content

Commit 41e4f47

Browse files
Merge pull request #19 from lumapps/fix/allow_short_jira_ref
Fix/allow short jira ref
2 parents d4e4973 + c9760ea commit 41e4f47

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

check.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ do
2020
validate "$MESSAGE"
2121
done <<< $COMMITS
2222

23-
echo "All commits succesfully checked"
23+
echo "All commits successfully checked"

git-commit-template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ type(scope): subject
2222
# kebab-case.
2323

2424
## Subject
25-
# A brief but meaningfull description of the change. Here are some
26-
# recommandation for writing your subject:
25+
# A brief but meaningful description of the change. Here are some
26+
# recommendation for writing your subject:
2727
# - use the imperative, present tense: "change" not "changed" nor "changes"
2828
# - don't capitalize first letter
2929
# - no "." (dot) at the end

validator.bats

Lines changed: 7 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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)