diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2018-09-19 15:08:55 +0200 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2018-09-19 15:27:50 +0200 |
commit | 8e3eb919243b3f787721669dbaf0eb376c9cec70 (patch) | |
tree | b0c6a253a474cb917ec44062a0e08ea55cf00ae4 /danger | |
parent | 617a723bb934e38f1467a1184e722415ecd6aec4 (diff) | |
download | gitlab-ce-8e3eb919243b3f787721669dbaf0eb376c9cec70.tar.gz |
Relax the subject line requirements for commits
This changes the hard limit of 50 to a soft limit of 50, with the new
hard limit being 72 characters. This gives people a bit more space,
while still (hopefully) guiding them towards subject lines that are
roughly 50 characters long.
Fixes https://gitlab.com/gitlab-org/release/framework/issues/16
Diffstat (limited to 'danger')
-rw-r--r-- | danger/commit_messages/Dangerfile | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/danger/commit_messages/Dangerfile b/danger/commit_messages/Dangerfile index a152ff837a9..c5ebb9b457e 100644 --- a/danger/commit_messages/Dangerfile +++ b/danger/commit_messages/Dangerfile @@ -38,6 +38,10 @@ def fail_commit(commit, message) fail("#{commit.sha}: #{message}") end +def warn_commit(commit, message) + warn("#{commit.sha}: #{message}") +end + def lines_changed_in_commit(commit) commit.diff_parent.stats[:total][:lines] end @@ -87,13 +91,21 @@ def lint_commits(commits) failures = true end - if subject.length > 50 + if subject.length > 72 fail_commit( commit, - 'The commit subject may not be longer than 50 characters' + 'The commit subject may not be longer than 72 characters' ) failures = true + elsif subject.length > 50 + warn_commit( + commit, + "This commit's subject line could be improved. " \ + 'Commit subjects are ideally no longer than roughly 50 characters, ' \ + 'though we allow up to 72 characters in the subject. ' \ + 'If possible, try to reduce the length of the subject to roughly 50 characters.' + ) end unless subject_starts_with_capital?(subject) |