File tree 2 files changed +9
-0
lines changed
lib/overcommit/hook/commit_msg
spec/overcommit/hook/commit_msg
2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ module Overcommit::Hook::CommitMsg
2
2
# Ensures commit message subject lines do not have a trailing period
3
3
class TrailingPeriod < Base
4
4
def run
5
+ return :pass if empty_message?
6
+
5
7
if commit_message_lines . first . rstrip . end_with? ( '.' )
6
8
return :warn , 'Please omit trailing period from commit message subject'
7
9
end
Original file line number Diff line number Diff line change 7
7
8
8
before do
9
9
subject . stub ( :commit_message_lines ) . and_return ( commit_msg . split ( "\n " ) )
10
+ subject . stub ( :empty_message? ) . and_return ( commit_msg . empty? )
11
+ end
12
+
13
+ context 'when commit message is empty' do
14
+ let ( :commit_msg ) { '' }
15
+
16
+ it { should pass }
10
17
end
11
18
12
19
context 'when subject contains a trailing period' do
You can’t perform that action at this time.
0 commit comments