Skip to content

Commit 1f06cca

Browse files
Merge pull request #23 from lumapps/chore/title-length
chore(validator): limit commit title to 100 chars
2 parents 7518718 + 0c04f0d commit 1f06cca

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,9 @@ a **subject**:
7676
<footer>
7777
```
7878

79-
- The first line of the commit message (the "Subject") cannot be longer than 70
80-
characters.
79+
- The first line of the commit message (the "Subject") should not be longer
80+
than 70 characters. However the limit is set to 100 characters to allow to
81+
exceed the 70 characters when it's really needed.
8182
- Any other line of the commit message cannot be longer 100 characters!
8283
- The body and footer are optional, but depends on the type, information can be
8384
mandatory.

validator.bats

+9-9
Original file line numberDiff line numberDiff line change
@@ -330,27 +330,27 @@ BROKEN:
330330
[[ $GLOBAL_SUBJECT == "message 3" ]]
331331
}
332332

333-
@test "header length cannot be more than 70" {
334-
run validate_header_length "01234567890123456789012345678901234567890123456789012345678901234567891"
333+
@test "header length cannot be more than 100" {
334+
run validate_header_length "01234567890123456789012345678901234567890123456789012345678901234567891234567890123456789012345678901"
335335
[ "$status" -eq $ERROR_HEADER_LENGTH ]
336336
}
337337

338-
@test "header length cannot be more than 70 with spaces" {
339-
run validate_header_length "012345678 012345678 012345678 012345678 012345678 012345678 012345678 1"
338+
@test "header length cannot be more than 100 with spaces" {
339+
run validate_header_length "012345678 012345678 012345678 012345678 012345678 012345678 012345678 123456789 0123456789 0123456789"
340340
[ "$status" -eq $ERROR_HEADER_LENGTH ]
341341
}
342342

343343
@test "header length cannot be more than 150 with spaces. overriden" {
344344
GLOBAL_MAX_LENGTH=150 validate_header_length "012345678 012345678 012345678 012345678 012345678 012345678 012345678 1"
345345
}
346346

347-
@test "header length can be 70" {
348-
run validate_header_length "0123456789012345678901234567890123456789012345678901234567890123456789"
347+
@test "header length can be 100" {
348+
run validate_header_length "0123456789012345678901234567890123456789012345678901234567890123456789123456789012345678901234567890"
349349
[ "$status" -eq 0 ]
350350
}
351351

352-
@test "header length can be 70 with spaces" {
353-
run validate_header_length "012345678 012345678 012345678 012345678 012345678 012345678 012345678 "
352+
@test "header length can be 100 with spaces" {
353+
run validate_header_length "012345678 012345678 012345678 012345678 012345678 012345678 012345678 123456789 0123456789 01234567 "
354354
[ "$status" -eq 0 ]
355355
}
356356

@@ -570,7 +570,7 @@ plop'
570570
}
571571

572572
@test "overall validation invalid header length" {
573-
MESSAGE='feat(plop): 01234567890123456789012345678901234567890123456789012345678901234567890'
573+
MESSAGE='feat(plop): 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789'
574574

575575
run validate "$MESSAGE"
576576
[[ "$status" -eq $ERROR_HEADER_LENGTH ]]

validator.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ GLOBAL_FOOTER=""
3434

3535
# Overridable variables
3636
GLOBAL_JIRA_TYPES="${GLOBAL_JIRA_TYPES:-feat fix}"
37-
GLOBAL_MAX_LENGTH="${GLOBAL_MAX_LENGTH:-70}"
37+
GLOBAL_MAX_LENGTH="${GLOBAL_MAX_LENGTH:-100}"
3838
GLOBAL_JIRA_IN_HEADER="${GLOBAL_JIRA_IN_HEADER:-}"
3939

4040
GLOBAL_TYPE=""

0 commit comments

Comments
 (0)