Commit 6c546aad authored by Dmytro Zaporozhets (DZ)'s avatar Dmytro Zaporozhets (DZ)

Merge branch 'fix-commit-linter-for-capitalized-subject' into 'master'

Fix CommitLinter to allow subjects that start with a capital letter

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