summaryrefslogtreecommitdiff
path: root/danger
diff options
context:
space:
mode:
authorAchilleas Pipinellis <axil@gitlab.com>2019-06-19 14:17:10 +0000
committerLin Jen-Shin <godfat@godfat.org>2019-06-19 14:17:10 +0000
commitf10c8481b3c44e955c086cb841e9391574c68308 (patch)
tree86d78ba602462ca68da1901ea05034672090735a /danger
parent30c447f1f264ea5d8fbe9b50b8d7b8608590fd50 (diff)
downloadgitlab-ce-f10c8481b3c44e955c086cb841e9391574c68308.tar.gz
When using suggestions, squash must be enabled
Diffstat (limited to 'danger')
-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