diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2018-09-14 14:31:24 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2018-09-14 14:55:29 +0300 |
commit | 42f90b5f50fc55fe17aec4118190599d46b43da8 (patch) | |
tree | dcd744a5168a923b388623345044fde90671bf2f | |
parent | 197beefc414c34ba9af89b91630f5d3137bf06de (diff) |
Relax Danger requirements about changed lines
This relaxes the commit rules regarding the number of changed lines.
Previously we required a detailed description if 20 or more lines were
changed. Starting with this commit we change the rules so Danger only
notifies you about writing a detailed description if:
1. A commit changes more than 3 files
2. The same commit changes more than 30 lines
This should make it easier to do a find replace to fix a typo, without
having to repeat what the subject line already says, while still
reminding developers to write a detailed description for new features
and other larger changes.
Fixes https://gitlab.com/gitlab-org/release/framework/issues/13
-rw-r--r-- | danger/commit_messages/Dangerfile | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/danger/commit_messages/Dangerfile b/danger/commit_messages/Dangerfile index 0341429d3cc..150e4327f8c 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' ) |