summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2019-06-19 14:17:11 +0000
committerLin Jen-Shin <godfat@godfat.org>2019-06-19 14:17:11 +0000
commitff61946b6941ab27f9515b3b118136e4318973de (patch)
tree86d78ba602462ca68da1901ea05034672090735a
parent30c447f1f264ea5d8fbe9b50b8d7b8608590fd50 (diff)
parentf10c8481b3c44e955c086cb841e9391574c68308 (diff)
downloadgitlab-ce-ff61946b6941ab27f9515b3b118136e4318973de.tar.gz
Merge branch 'danger-comply-with-suggestions' into 'master'
When using suggestions, squash must be enabled See merge request gitlab-org/gitlab-ce!29687
-rw-r--r--danger/commit_messages/Dangerfile12
1 files changed, 11 insertions, 1 deletions
diff --git a/danger/commit_messages/Dangerfile b/danger/commit_messages/Dangerfile
index bdb4343b1d6..ec494635f02 100644
--- a/danger/commit_messages/Dangerfile
+++ b/danger/commit_messages/Dangerfile
@@ -80,7 +80,7 @@ def unicode_emoji_regex
))x
end
-def lint_commit(commit)
+def lint_commit(commit) # rubocop:disable Metrics/AbcSize
# For now we'll ignore merge commits, as getting rid of those is a problem
# separate from enforcing good commit messages.
return false if commit.message.start_with?('Merge branch')
@@ -114,6 +114,16 @@ def lint_commit(commit)
)
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