Commit 0c6ce8c6 authored by Rémy Coutable's avatar Rémy Coutable

Fix CommitLinter to allow subjects that start with a capital letter

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent a40ef4fd
......@@ -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