Commit ff44ac74 authored by James Lopez's avatar James Lopez

Merge branch 'allow-section-prefix-in-commit-messages' into 'master'

danger: Allow section prefix in commit messages

See merge request gitlab-org/gitlab!46474
parents 8cdba719 d004e07b
...@@ -191,7 +191,7 @@ module Gitlab ...@@ -191,7 +191,7 @@ module Gitlab
end end
def subject_starts_with_lowercase? def subject_starts_with_lowercase?
first_char = subject.sub(/\A\[.+\]\s/, '')[0] first_char = subject.sub(/\A(\[.+\]|\w+:)\s/, '')[0]
first_char_downcased = first_char.downcase first_char_downcased = first_char.downcase
return true unless ('a'..'z').cover?(first_char_downcased) return true unless ('a'..'z').cover?(first_char_downcased)
......
...@@ -190,7 +190,9 @@ RSpec.describe Gitlab::Danger::CommitLinter do ...@@ -190,7 +190,9 @@ RSpec.describe Gitlab::Danger::CommitLinter do
[ [
'[ci skip] A commit message', '[ci skip] A commit message',
'[Ci skip] A commit message', '[Ci skip] A commit message',
'[API] A commit message' '[API] A commit message',
'api: A commit message',
'API: A commit message'
].each do |message| ].each do |message|
context "when subject is '#{message}'" do context "when subject is '#{message}'" do
let(:commit_message) { message } let(:commit_message) { message }
...@@ -207,6 +209,9 @@ RSpec.describe Gitlab::Danger::CommitLinter do ...@@ -207,6 +209,9 @@ RSpec.describe Gitlab::Danger::CommitLinter do
'[ci skip]A commit message', '[ci skip]A commit message',
'[Ci skip] A commit message', '[Ci skip] A commit message',
'[ci skip] a commit message', '[ci skip] a commit message',
'API: a commit message',
'API: a commit message',
'api: a commit message',
'! A commit message' '! A commit message'
].each do |message| ].each do |message|
context "when subject is '#{message}'" do context "when subject is '#{message}'" do
......
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