Commit f51f9a99 authored by Rémy Coutable's avatar Rémy Coutable Committed by Albert Salim

danger: Make two commit guidelines warnings instead of errors

1. In some cases, it doesn't make sense to enforce a commit body when
   the changes changes many lines/files, but are very trivial (e.g. mass
   replacemnt/removal).
2. In some cases (e.g. when including stacktrace), it doesn't make sense
   to wrap lines, making it impossible to satisfy the "details line may
   not be longer than 72 characters".
Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent a990ed2a
...@@ -127,7 +127,7 @@ def warn_or_fail_commits(failed_linters, default_to_fail: true) ...@@ -127,7 +127,7 @@ def warn_or_fail_commits(failed_linters, default_to_fail: true)
Array(failed_linters).each do |linter| Array(failed_linters).each do |linter|
linter.problems.each do |problem_key, problem_desc| linter.problems.each do |problem_key, problem_desc|
case problem_key case problem_key
when :subject_too_short, :subject_above_warning when :subject_too_short, :subject_above_warning, :details_too_many_changes, :details_line_too_long
warn_commit(linter.commit, problem_desc) warn_commit(linter.commit, problem_desc)
else else
self.__send__("#{level}_commit", linter.commit, problem_desc) # rubocop:disable GitlabSecurity/PublicSend self.__send__("#{level}_commit", linter.commit, problem_desc) # rubocop:disable GitlabSecurity/PublicSend
......
...@@ -131,9 +131,9 @@ Commit messages should follow the guidelines below, for reasons explained by Chr ...@@ -131,9 +131,9 @@ Commit messages should follow the guidelines below, for reasons explained by Chr
- The commit subject must not be longer than 72 characters. - The commit subject must not be longer than 72 characters.
- The commit subject must not end with a period. - The commit subject must not end with a period.
- The commit body must not contain more than 72 characters per line. - The commit body must not contain more than 72 characters per line.
- Commits that change 30 or more lines across at least 3 files must
describe these changes in the commit body.
- The commit subject or body must not contain Emojis. - The commit subject or body must not contain Emojis.
- Commits that change 30 or more lines across at least 3 files should
describe these changes in the commit body.
- Use issues and merge requests' full URLs instead of short references, - Use issues and merge requests' full URLs instead of short references,
as they are displayed as plain text outside of GitLab. as they are displayed as plain text outside of GitLab.
- The merge request should not contain more than 10 commit messages. - The merge request should not contain more than 10 commit messages.
...@@ -178,7 +178,7 @@ Example commit message template that can be used on your machine that embodies t ...@@ -178,7 +178,7 @@ Example commit message template that can be used on your machine that embodies t
# Do not end the subject line with a period # Do not end the subject line with a period
# Subject must contain at least 3 words # Subject must contain at least 3 words
# Separate subject from body with a blank line # Separate subject from body with a blank line
# Commits that change 30 or more lines across at least 3 files must # Commits that change 30 or more lines across at least 3 files should
# describe these changes in the commit body # describe these changes in the commit body
# Do not use Emojis # Do not use Emojis
# Use the body to explain what and why vs. how # Use the body to explain what and why vs. how
......
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