File tree 4 files changed +12
-12
lines changed
lib/overcommit/hook/pre_commit
spec/overcommit/hook/pre_commit
4 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -5,14 +5,14 @@ module Overcommit::Hook::PreCommit
5
5
class SemiStandard < Base
6
6
def run
7
7
result = execute ( command + applicable_files )
8
- output = result . stderr . chomp
8
+ output = result . stdout . chomp
9
9
return :pass if result . success? && output . empty?
10
10
11
11
# example message:
12
12
# path/to/file.js:1:1: Error message (ruleName)
13
13
extract_messages (
14
14
output . split ( "\n " ) [ 1 ..-1 ] , # ignore header line
15
- /^(?<file>[^:]+):(?<line>\d +)/
15
+ /^\s * (?<file>[^:]+):(?<line>\d +)/
16
16
)
17
17
end
18
18
end
Original file line number Diff line number Diff line change @@ -5,14 +5,14 @@ module Overcommit::Hook::PreCommit
5
5
class Standard < Base
6
6
def run
7
7
result = execute ( command + applicable_files )
8
- output = result . stderr . chomp
8
+ output = result . stdout . chomp
9
9
return :pass if result . success? && output . empty?
10
10
11
11
# example message:
12
12
# path/to/file.js:1:1: Error message (ruleName)
13
13
extract_messages (
14
14
output . split ( "\n " ) [ 1 ..-1 ] , # ignore header line
15
- /^(?<file>[^:]+):(?<line>\d +)/
15
+ /^\s * (?<file>[^:]+):(?<line>\d +)/
16
16
)
17
17
end
18
18
end
Original file line number Diff line number Diff line change 12
12
context 'when semistandard exits successfully' do
13
13
before do
14
14
result = double ( 'result' )
15
- result . stub ( success? : true , stderr : '' )
15
+ result . stub ( success? : true , stdout : '' )
16
16
subject . stub ( :execute ) . and_return ( result )
17
17
end
18
18
29
29
30
30
context 'and it reports an error' do
31
31
before do
32
- result . stub ( :stderr ) . and_return ( [
33
- 'Error: Code style check failed: ' ,
34
- 'file1.js:1:1: Extra semicolon. (eslint/semi)'
32
+ result . stub ( :stdout ) . and_return ( [
33
+ 'semistandard: Use Semicolons For All! (https://github.com/Flet/semistandard) ' ,
34
+ ' file1.js:1:1: Extra semicolon. (eslint/semi)'
35
35
] . join ( "\n " ) )
36
36
end
37
37
Original file line number Diff line number Diff line change 12
12
context 'when standard exits successfully' do
13
13
before do
14
14
result = double ( 'result' )
15
- result . stub ( success? : true , stderr : '' )
15
+ result . stub ( success? : true , stdout : '' )
16
16
subject . stub ( :execute ) . and_return ( result )
17
17
end
18
18
29
29
30
30
context 'and it reports an error' do
31
31
before do
32
- result . stub ( :stderr ) . and_return ( [
33
- 'Error : Use JavaScript Standard Style (https://github.com/feross/standard)' ,
34
- 'file1.js:1:1: Extra semicolon. (eslint/semi)'
32
+ result . stub ( :stdout ) . and_return ( [
33
+ 'standard : Use JavaScript Standard Style (https://github.com/feross/standard)' ,
34
+ ' file1.js:1:1: Extra semicolon. (eslint/semi)'
35
35
] . join ( "\n " ) )
36
36
end
37
37
You can’t perform that action at this time.
0 commit comments