Commit 27b223d5 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch '204905-relax-the-10-commits-rule' into 'master'

Relax the 10 commits maximum rule by making it a warning

Closes #204905

See merge request gitlab-org/gitlab!33300
parents a4f1f5d9 e4f5bd86
...@@ -6,6 +6,16 @@ COMMIT_MESSAGE_GUIDELINES = "https://docs.gitlab.com/ee/development/contributing ...@@ -6,6 +6,16 @@ COMMIT_MESSAGE_GUIDELINES = "https://docs.gitlab.com/ee/development/contributing
MORE_INFO = "For more information, take a look at our [Commit message guidelines](#{COMMIT_MESSAGE_GUIDELINES})." MORE_INFO = "For more information, take a look at our [Commit message guidelines](#{COMMIT_MESSAGE_GUIDELINES})."
THE_DANGER_JOB_TEXT = "the `danger-review` job" THE_DANGER_JOB_TEXT = "the `danger-review` job"
MAX_COMMITS_COUNT = 10 MAX_COMMITS_COUNT = 10
MAX_COMMITS_COUNT_EXCEEDED_MESSAGE = <<~MSG
This merge request includes more than %<max_commits_count>d commits. Each commit should meet the following criteria:
1. Have a well-written commit message.
1. Has all tests passing when used on its own (e.g. when using git checkout SHA).
1. Can be reverted on its own without also requiring the revert of commit that came before it.
1. Is small enough that it can be reviewed in isolation in under 30 minutes or so.
If this merge request contains commits that do not meet this criteria and/or contains intermediate work, please rebase these commits into a smaller number of commits or split this merge request into multiple smaller merge requests.
MSG
def gitlab_danger def gitlab_danger
@gitlab_danger ||= GitlabDanger.new(helper.gitlab_helper) @gitlab_danger ||= GitlabDanger.new(helper.gitlab_helper)
...@@ -94,11 +104,7 @@ def lint_commits(commits) ...@@ -94,11 +104,7 @@ def lint_commits(commits)
warn_or_fail_commits(failed_commit_linters, default_to_fail: !squash_mr?) warn_or_fail_commits(failed_commit_linters, default_to_fail: !squash_mr?)
if count_non_fixup_commits(commit_linters) > MAX_COMMITS_COUNT if count_non_fixup_commits(commit_linters) > MAX_COMMITS_COUNT
level = squash_mr? ? :warn : :fail self.warn(format(MAX_COMMITS_COUNT_EXCEEDED_MESSAGE, max_commits_count: MAX_COMMITS_COUNT))
self.__send__(level, # rubocop:disable GitlabSecurity/PublicSend
"This merge request includes more than #{MAX_COMMITS_COUNT} commits. " \
'Please rebase these commits into a smaller number of commits or split ' \
'this merge request into multiple smaller merge requests.')
end end
if squash_mr? if squash_mr?
......
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