summaryrefslogtreecommitdiff
path: root/danger/commit_messages
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-15 18:06:24 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-15 18:06:24 +0000
commiteca3cd3a9e7d9ea680086cad8150050ec8cdef3f (patch)
treec3d262e0d8e721fc138c2d617f501fb09876f1b6 /danger/commit_messages
parent6e81d7f6283fae1b22f66b9d9b133243921cbd9e (diff)
downloadgitlab-ce-eca3cd3a9e7d9ea680086cad8150050ec8cdef3f.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'danger/commit_messages')
-rw-r--r--danger/commit_messages/Dangerfile8
1 files changed, 7 insertions, 1 deletions
diff --git a/danger/commit_messages/Dangerfile b/danger/commit_messages/Dangerfile
index 064b8c94805..da5a63633c3 100644
--- a/danger/commit_messages/Dangerfile
+++ b/danger/commit_messages/Dangerfile
@@ -86,6 +86,12 @@ def unicode_emoji_regex
))x
end
+def count_filtered_commits(commits)
+ commits.count do |commit|
+ !commit.message.start_with?('fixup!', 'squash!')
+ end
+end
+
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.
@@ -285,7 +291,7 @@ def lint_commits(commits)
end
end
-if git.commits.length > 10 && !ce_upstream?
+if count_filtered_commits(git.commits) > 10 && !ce_upstream?
warn(
'This merge request includes more than 10 commits. ' \
'Please rebase these commits into a smaller number of commits.'