File tree 5 files changed +25
-18
lines changed
spec/overcommit/hook/pre_commit
5 files changed +25
-18
lines changed Original file line number Diff line number Diff line change @@ -12,4 +12,4 @@ gem 'travis', '~> 1.7'
12
12
gem 'coveralls'
13
13
14
14
# Pin RuboCop for Travis builds.
15
- gem 'rubocop' , '0.39 .0'
15
+ gem 'rubocop' , '0.40 .0'
Original file line number Diff line number Diff line change @@ -220,7 +220,8 @@ def processor_count # rubocop:disable all
220
220
if Overcommit ::OS . windows?
221
221
require 'win32ole'
222
222
result = WIN32OLE . connect ( 'winmgmts://' ) . ExecQuery (
223
- 'select NumberOfLogicalProcessors from Win32_Processor' )
223
+ 'select NumberOfLogicalProcessors from Win32_Processor'
224
+ )
224
225
result . to_enum . collect ( &:NumberOfLogicalProcessors ) . reduce ( :+ )
225
226
elsif File . readable? ( '/proc/cpuinfo' )
226
227
IO . read ( '/proc/cpuinfo' ) . scan ( /^processor/ ) . size
@@ -284,9 +285,10 @@ def convert_glob_to_absolute(glob)
284
285
# @param pattern [String]
285
286
# @param path [String]
286
287
def matches_path? ( pattern , path )
287
- File . fnmatch? ( pattern , path ,
288
- File ::FNM_PATHNAME | # Wildcard doesn't match separator
289
- File ::FNM_DOTMATCH # Wildcards match dotfiles
288
+ File . fnmatch? (
289
+ pattern , path ,
290
+ File ::FNM_PATHNAME | # Wildcard doesn't match separator
291
+ File ::FNM_DOTMATCH # Wildcards match dotfiles
290
292
)
291
293
end
292
294
Original file line number Diff line number Diff line change 4
4
let ( :default_config ) { Overcommit ::ConfigurationLoader . default_configuration }
5
5
let ( :branch_patterns ) { [ 'master' , 'release/*' ] }
6
6
let ( :config ) do
7
- default_config . merge ( Overcommit ::Configuration . new (
8
- 'PreCommit' => {
9
- 'ForbiddenBranches' => {
10
- 'branch_patterns' => branch_patterns
7
+ default_config . merge (
8
+ Overcommit ::Configuration . new (
9
+ 'PreCommit' => {
10
+ 'ForbiddenBranches' => {
11
+ 'branch_patterns' => branch_patterns
12
+ }
11
13
}
12
- } ) )
14
+ )
15
+ )
13
16
end
14
17
let ( :context ) { double ( 'context' ) }
15
18
subject { described_class . new ( config , context ) }
Original file line number Diff line number Diff line change 27
27
context 'and it reports an error' do
28
28
context 'on stdout' do
29
29
before do
30
- result . stub ( stderr : '' , stdout :
31
- 'file1.go:1:1: error should be the last type when returning multiple items'
30
+ result . stub (
31
+ stderr : '' ,
32
+ stdout : 'file1.go:1:1: error should be the last type when returning multiple items' ,
32
33
)
33
34
end
34
35
37
38
38
39
context 'on stderr' do
39
40
before do
40
- result . stub ( stdout : '' , stderr :
41
- "file1.go:1:1: expected 'package', found 'IDENT' foo"
41
+ result . stub (
42
+ stdout : '' ,
43
+ stderr : "file1.go:1:1: expected 'package', found 'IDENT' foo"
42
44
)
43
45
end
44
46
Original file line number Diff line number Diff line change 29
29
30
30
context 'when go tool vet is not installed' do
31
31
before do
32
- result . stub ( stderr :
33
- 'go tool: no such tool "vet"; to install:'
32
+ result . stub (
33
+ stderr : 'go tool: no such tool "vet"; to install:' ,
34
34
)
35
35
end
36
36
39
39
40
40
context 'and it reports an error' do
41
41
before do
42
- result . stub ( stderr :
43
- 'file1.go:1: possible formatting directive in Print call'
42
+ result . stub (
43
+ stderr : 'file1.go:1: possible formatting directive in Print call' ,
44
44
)
45
45
end
46
46
You can’t perform that action at this time.
0 commit comments