summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2019-07-16 16:51:32 +0000
committerLin Jen-Shin <godfat@godfat.org>2019-07-16 16:51:32 +0000
commitb9ec29700d80f76cb3bd3b9f54c5fc672fcc4967 (patch)
tree4e8858299dee69959c77731a29d6bd351993970a
parent872eae04c826f1cf61b7e04ed17808a05fdd25a1 (diff)
parent2549d2f08ab1e1c8c1436896e1db15655a112c62 (diff)
downloadgitlab-ce-b9ec29700d80f76cb3bd3b9f54c5fc672fcc4967.tar.gz
Merge branch 'danger-apply-suggestions-72-chars' into 'master'
Do not fail danger if suggestion commit msg > 72 See merge request gitlab-org/gitlab-ce!30090
-rw-r--r--danger/commit_messages/Dangerfile23
1 files changed, 13 insertions, 10 deletions
diff --git a/danger/commit_messages/Dangerfile b/danger/commit_messages/Dangerfile
index ec494635f02..0c675cc4c9c 100644
--- a/danger/commit_messages/Dangerfile
+++ b/danger/commit_messages/Dangerfile
@@ -88,6 +88,19 @@ def lint_commit(commit) # rubocop:disable Metrics/AbcSize
# We ignore revert commits as they are well structured by Git already
return false if commit.message.start_with?('Revert "')
+ # Fail if a suggestion commit is used and squash is not enabled
+ if commit.message.start_with?('Apply suggestion to')
+ if gitlab.mr_json['squash']
+ return false
+ else
+ fail_commit(
+ commit,
+ 'If you are applying suggestions, enable squash in the merge request and re-run the failed job'
+ )
+ return true
+ end
+ end
+
failures = false
subject, separator, details = commit.message.split("\n", 3)
@@ -114,16 +127,6 @@ def lint_commit(commit) # rubocop:disable Metrics/AbcSize
)
end
- # Fail if a suggestion commit is used and squash is not enabled
- if commit.message.start_with?('Apply suggestion to') && !gitlab.mr_json['squash']
- fail_commit(
- commit,
- 'If you are applying suggestions, squash needs to be enabled in the merge request'
- )
-
- failures = true
- end
-
unless subject_starts_with_capital?(subject)
fail_commit(commit, 'The commit subject must start with a capital letter')
failures = true