Skip to content

Commit 74261b2

Browse files
authored
Merge pull request #27 from lumapps/allow-more-than-limit-line-if-no-space
feat(validator): allow lines longer than max if no spaces
2 parents d021236 + 4293d0f commit 74261b2

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

validator.bats

+11-1
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,16 @@ LUM-2345'
452452
[[ "$status" -eq 0 ]]
453453
}
454454

455+
@test "body with 100+ line length should be valid if no space" {
456+
MESSAGE='
457+
0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_
458+
459+
LUM-2345'
460+
461+
run validate_body_length "$MESSAGE"
462+
[[ "$status" -eq 0 ]]
463+
}
464+
455465
@test "body with trailing space on line should not be valid" {
456466
MESSAGE='pdzofjzf '
457467

@@ -612,7 +622,7 @@ LUM-2345'
612622
@test "overall validation invalid body length" {
613623
MESSAGE='feat(scope1): subject
614624
615-
12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901
625+
1 2 3 4 5678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901
616626
617627
LUM-2345'
618628

validator.sh

+3
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ validate_body_length() {
189189

190190
while IFS= read -r LINE ;
191191
do
192+
# Skip lines with no spaces as they can't be split
193+
$(echo -n "$LINE" | grep -q "\s") || continue
194+
192195
local LENGTH
193196

194197
LENGTH="$(echo -n "$LINE" | wc -c)"

0 commit comments

Comments
 (0)