Commit 9d5e00e6 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'relax-danger-commit-subject-rules' into 'master'

Relax the subject line requirements for commits

Closes gitlab-org/release/framework#16

See merge request gitlab-org/gitlab-ce!21811
parents 38cf0b67 8e3eb919
...@@ -38,6 +38,10 @@ def fail_commit(commit, message) ...@@ -38,6 +38,10 @@ def fail_commit(commit, message)
fail("#{commit.sha}: #{message}") fail("#{commit.sha}: #{message}")
end end
def warn_commit(commit, message)
warn("#{commit.sha}: #{message}")
end
def lines_changed_in_commit(commit) def lines_changed_in_commit(commit)
commit.diff_parent.stats[:total][:lines] commit.diff_parent.stats[:total][:lines]
end end
...@@ -87,13 +91,21 @@ def lint_commits(commits) ...@@ -87,13 +91,21 @@ def lint_commits(commits)
failures = true failures = true
end end
if subject.length > 50 if subject.length > 72
fail_commit( fail_commit(
commit, commit,
'The commit subject may not be longer than 50 characters' 'The commit subject may not be longer than 72 characters'
) )
failures = true 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 end
unless subject_starts_with_capital?(subject) unless subject_starts_with_capital?(subject)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment