File tree 2 files changed +19
-1
lines changed
lib/fit_commit/validators
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 3
3
module FitCommit
4
4
module Validators
5
5
class CapitalizeSubject < Base
6
+ AUTOSQUASH = /\A (fixup|squash)! /
7
+
6
8
def validate_line ( lineno , text )
7
- if lineno == 1 && text [ 0 ] =~ /[[:lower:]]/
9
+ if lineno == 1 && text [ 0 ] =~ /[[:lower:]]/ && text !~ AUTOSQUASH
8
10
add_error ( lineno , "Begin all subject lines with a capital letter." )
9
11
end
10
12
end
Original file line number Diff line number Diff line change 17
17
assert_empty validator . warnings
18
18
end
19
19
end
20
+ describe "subject is fixup commit" do
21
+ let ( :commit_msg ) { "fixup! foo bar" }
22
+ it "does not have errors/warnings" do
23
+ validator . validate ( commit_lines )
24
+ assert_empty validator . errors
25
+ assert_empty validator . warnings
26
+ end
27
+ end
28
+ describe "subject is squash commit" do
29
+ let ( :commit_msg ) { "squash! foo bar" }
30
+ it "does not have errors/warnings" do
31
+ validator . validate ( commit_lines )
32
+ assert_empty validator . errors
33
+ assert_empty validator . warnings
34
+ end
35
+ end
20
36
describe "subject is capitalized" do
21
37
let ( :commit_msg ) { "Foo bar" }
22
38
it "does not have errors/warnings" do
You can’t perform that action at this time.
0 commit comments