Commit d7e60dd2 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge branch '119108-make-the-10-commits-rule-fail-danger-check' into 'master'

Always lint commits and fail if MR has more than 10 commits

Closes #119108

See merge request gitlab-org/gitlab!22099
parents 719a29e8 7d5cdc8c
...@@ -59,12 +59,6 @@ def subject_starts_with_capital?(subject) ...@@ -59,12 +59,6 @@ def subject_starts_with_capital?(subject)
first_char.upcase == first_char first_char.upcase == first_char
end end
def ce_upstream?
return unless gitlab_danger.ci?
gitlab.mr_labels.any? { |label| label == 'CE upstream' }
end
def too_many_changed_lines?(commit) def too_many_changed_lines?(commit)
commit.diff_parent.stats[:total][:files] > 3 && commit.diff_parent.stats[:total][:files] > 3 &&
lines_changed_in_commit(commit) >= 30 lines_changed_in_commit(commit) >= 30
...@@ -291,11 +285,11 @@ def lint_commits(commits) ...@@ -291,11 +285,11 @@ def lint_commits(commits)
end end
end end
if count_filtered_commits(git.commits) > 10 && !ce_upstream? lint_commits(git.commits)
warn(
if count_filtered_commits(git.commits) > 10
fail(
'This merge request includes more than 10 commits. ' \ 'This merge request includes more than 10 commits. ' \
'Please rebase these commits into a smaller number of commits.' 'Please rebase these commits into a smaller number of commits.'
) )
else
lint_commits(git.commits)
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment