summaryrefslogtreecommitdiff
path: root/danger/commit_messages
diff options
context:
space:
mode:
Diffstat (limited to 'danger/commit_messages')
-rw-r--r--danger/commit_messages/Dangerfile9
1 files changed, 7 insertions, 2 deletions
diff --git a/danger/commit_messages/Dangerfile b/danger/commit_messages/Dangerfile
index b2099a8c198..e982e8ed7c5 100644
--- a/danger/commit_messages/Dangerfile
+++ b/danger/commit_messages/Dangerfile
@@ -26,6 +26,11 @@ def ce_upstream?
gitlab.mr_labels.any? { |label| label == 'CE upstream' }
end
+def too_many_changed_lines?(commit)
+ commit.diff_parent.stats[:total][:files] > 3 &&
+ lines_changed_in_commit(commit) >= 30
+end
+
def lint_commits(commits)
failures = false
@@ -102,10 +107,10 @@ def lint_commits(commits)
failures = true
end
- if !details && lines_changed_in_commit(commit) >= 20
+ if !details && too_many_changed_lines?(commit)
fail_commit(
commit,
- 'Commits that change more than 20 lines ' \
+ 'Commits that change 30 or more lines in more than three files ' \
'must describe these changes in the commit body'
)