diff options
Diffstat (limited to 'danger/commit_messages')
-rw-r--r-- | danger/commit_messages/Dangerfile | 8 |
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.' |