File tree 31 files changed +39
-35
lines changed
lib/overcommit/hook/pre_commit
31 files changed +39
-35
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit
4
4
# @see https://github.com/thekompanee/chamber
5
5
class ChamberSecurity < Base
6
6
def run
7
- result = execute ( command + applicable_files )
7
+ result = execute ( command , args : applicable_files )
8
8
9
9
return :pass if result . stdout . empty?
10
10
[ :fail , "These settings appear to need to be secured but were not: #{ result . stdout } " ]
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ class CoffeeLint < Base
15
15
end
16
16
17
17
def run
18
- result = execute ( command + applicable_files )
18
+ result = execute ( command , args : applicable_files )
19
19
parse_messages ( result . stdout )
20
20
end
21
21
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ class CssLint < Base
10
10
/x
11
11
12
12
def run
13
- result = execute ( command + applicable_files )
13
+ result = execute ( command , args : applicable_files )
14
14
output = result . stdout . chomp
15
15
return :pass if result . success? && output . empty?
16
16
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit
4
4
# @see http://eslint.org/
5
5
class EsLint < Base
6
6
def run
7
- result = execute ( command + applicable_files )
7
+ result = execute ( command , args : applicable_files )
8
8
output = result . stdout . chomp
9
9
return :pass if result . success? && output . empty?
10
10
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit
4
4
# @see https://github.com/golang/lint
5
5
class GoLint < Base
6
6
def run
7
- result = execute ( command + applicable_files )
7
+ result = execute ( command , args : applicable_files )
8
8
output = result . stdout + result . stderr
9
9
# Unfortunately the exit code is always 0
10
10
return :pass if output . empty?
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit
4
4
# @see https://godoc.org/code.google.com/p/go-zh.tools/cmd/vet
5
5
class GoVet < Base
6
6
def run
7
- result = execute ( command + applicable_files )
7
+ result = execute ( command , args : applicable_files )
8
8
return :pass if result . success?
9
9
10
10
if result . stderr =~ /no such tool "vet"/
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ class HamlLint < Base
8
8
end
9
9
10
10
def run
11
- result = execute ( command + applicable_files )
11
+ result = execute ( command , args : applicable_files )
12
12
return :pass if result . success?
13
13
14
14
extract_messages (
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit
4
4
# @see https://github.com/toy/image_optim
5
5
class ImageOptim < Base
6
6
def run
7
- result = execute ( command + applicable_files )
7
+ result = execute ( command , args : applicable_files )
8
8
return [ :fail , result . stdout + result . stderr ] unless result . success?
9
9
10
10
optimized_files = extract_optimized_files ( result . stdout )
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ class JavaCheckstyle < Base
6
6
MESSAGE_REGEX = /^(?<file>(?:\w :)?[^:]+):(?<line>\d +)/
7
7
8
8
def run
9
- result = execute ( command + applicable_files )
9
+ result = execute ( command , args : applicable_files )
10
10
output = result . stdout . chomp
11
11
return :pass if result . success?
12
12
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit
4
4
# @see http://jshint.com/
5
5
class JsHint < Base
6
6
def run
7
- result = execute ( command + applicable_files )
7
+ result = execute ( command , args : applicable_files )
8
8
output = result . stdout . chomp
9
9
10
10
return :pass if result . success? && output . empty?
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ class JsLint < Base
6
6
MESSAGE_REGEX = /(?<file>(?:\w :)?[^:]+):(?<line>\d +)/
7
7
8
8
def run
9
- result = execute ( command + applicable_files )
9
+ result = execute ( command , args : applicable_files )
10
10
return :pass if result . success?
11
11
12
12
# example message:
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ module Overcommit::Hook::PreCommit
5
5
# @see http://jscs.info/
6
6
class Jscs < Base
7
7
def run
8
- result = execute ( command + applicable_files )
8
+ result = execute ( command , args : applicable_files )
9
9
return :pass if result . success?
10
10
11
11
if result . status == 1
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit
4
4
# @see https://pypi.python.org/pypi/pep257
5
5
class Pep257 < Base
6
6
def run
7
- result = execute ( command + applicable_files )
7
+ result = execute ( command , args : applicable_files )
8
8
return :pass if result . success?
9
9
10
10
output = result . stderr . chomp
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit
4
4
# @see https://pypi.python.org/pypi/pep8
5
5
class Pep8 < Base
6
6
def run
7
- result = execute ( command + applicable_files )
7
+ result = execute ( command , args : applicable_files )
8
8
output = result . stdout . chomp
9
9
10
10
return :pass if result . success? && output . empty?
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ class PuppetLint < Base
10
10
end
11
11
12
12
def run
13
- result = execute ( command + applicable_files )
13
+ result = execute ( command , args : applicable_files )
14
14
output = result . stdout . chomp . gsub ( /^"|"$/ , '' )
15
15
return :pass if result . success? && output . empty?
16
16
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ class Pyflakes < Base
6
6
MESSAGE_REGEX = /^(?<file>(?:\w :)?[^:]+):(?<line>\d +):/
7
7
8
8
def run
9
- result = execute ( command + applicable_files )
9
+ result = execute ( command , args : applicable_files )
10
10
return :pass if result . success?
11
11
12
12
errors = get_messages ( result . stderr , :error )
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ class Pylint < Base
13
13
end
14
14
15
15
def run
16
- result = execute ( command + applicable_files )
16
+ result = execute ( command , args : applicable_files )
17
17
return :pass if result . success?
18
18
19
19
output = result . stdout . chomp
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ class PythonFlake8 < Base
13
13
end
14
14
15
15
def run
16
- result = execute ( command + applicable_files )
16
+ result = execute ( command , args : applicable_files )
17
17
return :pass if result . success?
18
18
19
19
output = result . stdout . chomp
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit
4
4
# @see https://github.com/troessner/reek
5
5
class Reek < Base
6
6
def run
7
- result = execute ( command + applicable_files )
7
+ result = execute ( command , args : applicable_files )
8
8
return :pass if result . success?
9
9
10
10
output = scrub_output ( result . stdout + result . stderr )
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ class RubyLint < Base
8
8
end
9
9
10
10
def run
11
- result = execute ( command + applicable_files )
11
+ result = execute ( command , args : applicable_files )
12
12
return :pass if result . success?
13
13
14
14
extract_messages (
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ class Scalariform < Base
6
6
MESSAGE_REGEX = /^\[ (?<type>FAILED|ERROR)\] \s +(?<file>(?:\w :)?.+)/
7
7
8
8
def run
9
- result = execute ( command + applicable_files )
9
+ result = execute ( command , args : applicable_files )
10
10
11
11
# example message:
12
12
# [FAILED] path/to/file.scala
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ class Scalastyle < Base
11
11
/x
12
12
13
13
def run
14
- result = execute ( command + applicable_files )
14
+ result = execute ( command , args : applicable_files )
15
15
output = result . stdout . chomp
16
16
messages = output . split ( "\n " ) . grep ( MESSAGE_REGEX )
17
17
return :pass if result . success? && messages . empty?
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ class ScssLint < Base
8
8
end
9
9
10
10
def run
11
- result = execute ( command + applicable_files )
11
+ result = execute ( command , args : applicable_files )
12
12
13
13
# Status code 81 indicates the applicable files were all filtered by
14
14
# exclusions defined by the configuration. In this case, we're happy to
Original file line number Diff line number Diff line change @@ -3,16 +3,18 @@ module Overcommit::Hook::PreCommit
3
3
#
4
4
# @see https://github.com/Flet/semistandard
5
5
class SemiStandard < Base
6
+ MESSAGE_REGEX = /^\s *(?<file>(?:\w :)?[^:]+):(?<line>\d +)/
7
+
6
8
def run
7
- result = execute ( command + applicable_files )
9
+ result = execute ( command , args : applicable_files )
8
10
output = result . stdout . chomp
9
11
return :pass if result . success? && output . empty?
10
12
11
13
# example message:
12
14
# path/to/file.js:1:1: Error message (ruleName)
13
15
extract_messages (
14
- output . split ( "\n " ) [ 1 ..- 1 ] , # ignore header line
15
- /^ \s *(?<file>(?: \w :)?[^:]+):(?<line> \d +)/
16
+ output . split ( "\n " ) . grep ( MESSAGE_REGEX ) , # ignore header line
17
+ MESSAGE_REGEX
16
18
)
17
19
end
18
20
end
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ class ShellCheck < Base
8
8
end
9
9
10
10
def run
11
- result = execute ( command + applicable_files )
11
+ result = execute ( command , args : applicable_files )
12
12
return :pass if result . success?
13
13
14
14
extract_messages (
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ class SlimLint < Base
8
8
end
9
9
10
10
def run
11
- result = execute ( command + applicable_files )
11
+ result = execute ( command , args : applicable_files )
12
12
return :pass if result . success?
13
13
14
14
extract_messages (
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ class Sqlint < Base
10
10
end
11
11
12
12
def run
13
- result = execute ( command + applicable_files )
13
+ result = execute ( command , args : applicable_files )
14
14
output = result . stdout . chomp
15
15
return :pass if result . success? && output . empty?
16
16
Original file line number Diff line number Diff line change @@ -3,16 +3,18 @@ module Overcommit::Hook::PreCommit
3
3
#
4
4
# @see https://github.com/feross/standard
5
5
class Standard < Base
6
+ MESSAGE_REGEX = /^\s *(?<file>(?:\w :)?[^:]+):(?<line>\d +)/
7
+
6
8
def run
7
- result = execute ( command + applicable_files )
9
+ result = execute ( command , args : applicable_files )
8
10
output = result . stdout . chomp
9
11
return :pass if result . success? && output . empty?
10
12
11
13
# example message:
12
14
# path/to/file.js:1:1: Error message (ruleName)
13
15
extract_messages (
14
- output . split ( "\n " ) [ 1 ..- 1 ] , # ignore header line
15
- /^ \s *(?<file>(?: \w :)?[^:]+):(?<line> \d +)/
16
+ output . split ( "\n " ) . grep ( MESSAGE_REGEX ) , # ignore header line
17
+ MESSAGE_REGEX
16
18
)
17
19
end
18
20
end
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit
4
4
# @see https://github.com/travis-ci/travis.rb
5
5
class TravisLint < Base
6
6
def run
7
- result = execute ( command + applicable_files )
7
+ result = execute ( command , args : applicable_files )
8
8
return :pass if result . success?
9
9
10
10
[ :fail , ( result . stdout + result . stderr ) . strip ]
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit
4
4
# @see https://github.com/Kuniwak/vint
5
5
class Vint < Base
6
6
def run
7
- result = execute ( command + applicable_files )
7
+ result = execute ( command , args : applicable_files )
8
8
return :pass if result . success?
9
9
10
10
return [ :fail , result . stderr ] unless result . stderr . empty?
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ class XmlLint < Base
6
6
MESSAGE_REGEX = /^(?<file>(?:\w :)?[^:]+):(?<line>\d +):/
7
7
8
8
def run
9
- result = execute ( command + applicable_files )
9
+ result = execute ( command , args : applicable_files )
10
10
output = result . stderr . chomp
11
11
12
12
return :pass if result . success? && output . empty?
You can’t perform that action at this time.
0 commit comments