Commit d3c6f9c4 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'ignore-reverts' into 'master'

Ignore revert commits

Closes #57912

See merge request gitlab-org/gitlab-ce!25396
parents af2ebd71 d8145aa6
......@@ -64,11 +64,12 @@ def too_many_changed_lines?(commit)
lines_changed_in_commit(commit) >= 30
end
def lint_commits(commits)
failures = false
emoji_checker = EmojiChecker.new
def emoji_checker
@emoji_checker ||= EmojiChecker.new
end
unicode_emoji_regex = %r((
def unicode_emoji_regex
@unicode_emoji_regex ||= %r((
[\u{1F300}-\u{1F5FF}] |
[\u{1F1E6}-\u{1F1FF}] |
[\u{2700}-\u{27BF}] |
......@@ -77,12 +78,17 @@ def lint_commits(commits)
[\u{1F680}-\u{1F6FF}] |
[\u{2600}-\u{26FF}]
))x
end
commits.each do |commit|
def lint_commit(commit)
# For now we'll ignore merge commits, as getting rid of those is a problem
# separate from enforcing good commit messages.
next if commit.message.start_with?('Merge branch')
return false if commit.message.start_with?('Merge branch')
# We ignore revert commits as they are well structured by Git already
return false if commit.message.start_with?('Revert "')
failures = false
subject, separator, details = commit.message.split("\n", 3)
if subject.split.length < 3
......@@ -188,9 +194,16 @@ def lint_commits(commits)
failures = true
end
failures
end
def lint_commits(commits)
failed = commits.reject do |commit|
lint_commit(commit)
end
if failures
if failed.any?
markdown(<<~MARKDOWN)
## Commit message standards
......
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