Skip to content

Commit fa03670

Browse files
committed
Limit line length in commit message body to 72 characters
Following a discussion in Moodle Dev chat and the recommendation from the Commit cheat sheet the commit message body should wrap at 72 and not at 132 characters. Signed-off-by: Daniel Ziegenberg <[email protected]>
1 parent c687fa9 commit fa03670

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

tests/verify_commit_messages.bats

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,15 @@ commit_apply_fixture_and_run() {
9090
@test "verify_commit_messages/verify_commit_messages.sh: body too long" {
9191
commit_apply_fixture_and_run too-long-body.patch
9292
assert_failure
93-
assert_output "${shorthash}*error*The line #3 has more than 132 characters (found: 181)"
93+
assert_output "${shorthash}*error*The line #3 has more than 72 characters (found: 181)"
9494
}
9595

9696
@test "verify_commit_messages/verify_commit_messages.sh: backslash ended lines" {
9797
commit_apply_fixture_and_run backslash-ended-lines.patch
9898
assert_failure
9999
refute_output "#3"
100100
refute_output "#5"
101-
assert_output "${shorthash}*error*The line #7 has more than 132 characters (found: 141)"
101+
assert_output "${shorthash}*error*The line #7 has more than 72 characters (found: 141)"
102102
}
103103

104104
@test "verify_commit_messages/verify_commit_messages.sh: AMOS bad syntax" {

verify_commit_messages/verify_commit_messages.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# COMMIT (short) * LEVEL (error or warning) * DESCRIPTION (details)
1919
# Example:
2020
# 1234abcd*error*Commit messages does not start with issue code.
21-
# 2345bcde*warning*Body line too long (184 > 132).
21+
# 2345bcde*warning*Body line too long (184 > 72).
2222
# 2345cdef*error*Subject line too long (75 > 72).
2323

2424
# Don't be strict. Script has own error control handle
@@ -200,10 +200,10 @@ for c in ${commits}; do
200200
fi
201201
# check rest of lines
202202
else
203-
# verify 3rd and following lines are <= 132 chars long. Warn.
203+
# verify 3rd and following lines are <= 72 chars long. Warn.
204204
len=$(echo "${line}" | wc -c)
205-
if [[ ${len} -gt 132 ]]; then
206-
echo "${c}*error*The line #${currentline} has more than 132 characters (found: ${len})"
205+
if [[ ${len} -gt 72 ]]; then
206+
echo "${c}*error*The line #${currentline} has more than 72 characters (found: ${len})"
207207
numproblems=$((numproblems+1))
208208
fi
209209
fi

0 commit comments

Comments
 (0)