Skip to content

Commit 7b47f7a

Browse files
committed
Convert a number of pre-commit hooks to use splittable args
1 parent 6d2011e commit 7b47f7a

31 files changed

+39
-35
lines changed

lib/overcommit/hook/pre_commit/chamber_security.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit
44
# @see https://github.com/thekompanee/chamber
55
class ChamberSecurity < Base
66
def run
7-
result = execute(command + applicable_files)
7+
result = execute(command, args: applicable_files)
88

99
return :pass if result.stdout.empty?
1010
[:fail, "These settings appear to need to be secured but were not: #{result.stdout}"]

lib/overcommit/hook/pre_commit/coffee_lint.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class CoffeeLint < Base
1515
end
1616

1717
def run
18-
result = execute(command + applicable_files)
18+
result = execute(command, args: applicable_files)
1919
parse_messages(result.stdout)
2020
end
2121

lib/overcommit/hook/pre_commit/css_lint.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class CssLint < Base
1010
/x
1111

1212
def run
13-
result = execute(command + applicable_files)
13+
result = execute(command, args: applicable_files)
1414
output = result.stdout.chomp
1515
return :pass if result.success? && output.empty?
1616

lib/overcommit/hook/pre_commit/es_lint.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit
44
# @see http://eslint.org/
55
class EsLint < Base
66
def run
7-
result = execute(command + applicable_files)
7+
result = execute(command, args: applicable_files)
88
output = result.stdout.chomp
99
return :pass if result.success? && output.empty?
1010

lib/overcommit/hook/pre_commit/go_lint.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit
44
# @see https://github.com/golang/lint
55
class GoLint < Base
66
def run
7-
result = execute(command + applicable_files)
7+
result = execute(command, args: applicable_files)
88
output = result.stdout + result.stderr
99
# Unfortunately the exit code is always 0
1010
return :pass if output.empty?

lib/overcommit/hook/pre_commit/go_vet.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit
44
# @see https://godoc.org/code.google.com/p/go-zh.tools/cmd/vet
55
class GoVet < Base
66
def run
7-
result = execute(command + applicable_files)
7+
result = execute(command, args: applicable_files)
88
return :pass if result.success?
99

1010
if result.stderr =~ /no such tool "vet"/

lib/overcommit/hook/pre_commit/haml_lint.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class HamlLint < Base
88
end
99

1010
def run
11-
result = execute(command + applicable_files)
11+
result = execute(command, args: applicable_files)
1212
return :pass if result.success?
1313

1414
extract_messages(

lib/overcommit/hook/pre_commit/image_optim.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit
44
# @see https://github.com/toy/image_optim
55
class ImageOptim < Base
66
def run
7-
result = execute(command + applicable_files)
7+
result = execute(command, args: applicable_files)
88
return [:fail, result.stdout + result.stderr] unless result.success?
99

1010
optimized_files = extract_optimized_files(result.stdout)

lib/overcommit/hook/pre_commit/java_checkstyle.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class JavaCheckstyle < Base
66
MESSAGE_REGEX = /^(?<file>(?:\w:)?[^:]+):(?<line>\d+)/
77

88
def run
9-
result = execute(command + applicable_files)
9+
result = execute(command, args: applicable_files)
1010
output = result.stdout.chomp
1111
return :pass if result.success?
1212

lib/overcommit/hook/pre_commit/js_hint.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit
44
# @see http://jshint.com/
55
class JsHint < Base
66
def run
7-
result = execute(command + applicable_files)
7+
result = execute(command, args: applicable_files)
88
output = result.stdout.chomp
99

1010
return :pass if result.success? && output.empty?

lib/overcommit/hook/pre_commit/js_lint.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class JsLint < Base
66
MESSAGE_REGEX = /(?<file>(?:\w:)?[^:]+):(?<line>\d+)/
77

88
def run
9-
result = execute(command + applicable_files)
9+
result = execute(command, args: applicable_files)
1010
return :pass if result.success?
1111

1212
# example message:

lib/overcommit/hook/pre_commit/jscs.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module Overcommit::Hook::PreCommit
55
# @see http://jscs.info/
66
class Jscs < Base
77
def run
8-
result = execute(command + applicable_files)
8+
result = execute(command, args: applicable_files)
99
return :pass if result.success?
1010

1111
if result.status == 1

lib/overcommit/hook/pre_commit/pep257.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit
44
# @see https://pypi.python.org/pypi/pep257
55
class Pep257 < Base
66
def run
7-
result = execute(command + applicable_files)
7+
result = execute(command, args: applicable_files)
88
return :pass if result.success?
99

1010
output = result.stderr.chomp

lib/overcommit/hook/pre_commit/pep8.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit
44
# @see https://pypi.python.org/pypi/pep8
55
class Pep8 < Base
66
def run
7-
result = execute(command + applicable_files)
7+
result = execute(command, args: applicable_files)
88
output = result.stdout.chomp
99

1010
return :pass if result.success? && output.empty?

lib/overcommit/hook/pre_commit/puppet_lint.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class PuppetLint < Base
1010
end
1111

1212
def run
13-
result = execute(command + applicable_files)
13+
result = execute(command, args: applicable_files)
1414
output = result.stdout.chomp.gsub(/^"|"$/, '')
1515
return :pass if result.success? && output.empty?
1616

lib/overcommit/hook/pre_commit/pyflakes.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Pyflakes < Base
66
MESSAGE_REGEX = /^(?<file>(?:\w:)?[^:]+):(?<line>\d+):/
77

88
def run
9-
result = execute(command + applicable_files)
9+
result = execute(command, args: applicable_files)
1010
return :pass if result.success?
1111

1212
errors = get_messages(result.stderr, :error)

lib/overcommit/hook/pre_commit/pylint.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Pylint < Base
1313
end
1414

1515
def run
16-
result = execute(command + applicable_files)
16+
result = execute(command, args: applicable_files)
1717
return :pass if result.success?
1818

1919
output = result.stdout.chomp

lib/overcommit/hook/pre_commit/python_flake8.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class PythonFlake8 < Base
1313
end
1414

1515
def run
16-
result = execute(command + applicable_files)
16+
result = execute(command, args: applicable_files)
1717
return :pass if result.success?
1818

1919
output = result.stdout.chomp

lib/overcommit/hook/pre_commit/reek.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit
44
# @see https://github.com/troessner/reek
55
class Reek < Base
66
def run
7-
result = execute(command + applicable_files)
7+
result = execute(command, args: applicable_files)
88
return :pass if result.success?
99

1010
output = scrub_output(result.stdout + result.stderr)

lib/overcommit/hook/pre_commit/ruby_lint.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class RubyLint < Base
88
end
99

1010
def run
11-
result = execute(command + applicable_files)
11+
result = execute(command, args: applicable_files)
1212
return :pass if result.success?
1313

1414
extract_messages(

lib/overcommit/hook/pre_commit/scalariform.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Scalariform < Base
66
MESSAGE_REGEX = /^\[(?<type>FAILED|ERROR)\]\s+(?<file>(?:\w:)?.+)/
77

88
def run
9-
result = execute(command + applicable_files)
9+
result = execute(command, args: applicable_files)
1010

1111
# example message:
1212
# [FAILED] path/to/file.scala

lib/overcommit/hook/pre_commit/scalastyle.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Scalastyle < Base
1111
/x
1212

1313
def run
14-
result = execute(command + applicable_files)
14+
result = execute(command, args: applicable_files)
1515
output = result.stdout.chomp
1616
messages = output.split("\n").grep(MESSAGE_REGEX)
1717
return :pass if result.success? && messages.empty?

lib/overcommit/hook/pre_commit/scss_lint.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class ScssLint < Base
88
end
99

1010
def run
11-
result = execute(command + applicable_files)
11+
result = execute(command, args: applicable_files)
1212

1313
# Status code 81 indicates the applicable files were all filtered by
1414
# exclusions defined by the configuration. In this case, we're happy to

lib/overcommit/hook/pre_commit/semi_standard.rb

+5-3
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@ module Overcommit::Hook::PreCommit
33
#
44
# @see https://github.com/Flet/semistandard
55
class SemiStandard < Base
6+
MESSAGE_REGEX = /^\s*(?<file>(?:\w:)?[^:]+):(?<line>\d+)/
7+
68
def run
7-
result = execute(command + applicable_files)
9+
result = execute(command, args: applicable_files)
810
output = result.stdout.chomp
911
return :pass if result.success? && output.empty?
1012

1113
# example message:
1214
# path/to/file.js:1:1: Error message (ruleName)
1315
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
1618
)
1719
end
1820
end

lib/overcommit/hook/pre_commit/shell_check.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class ShellCheck < Base
88
end
99

1010
def run
11-
result = execute(command + applicable_files)
11+
result = execute(command, args: applicable_files)
1212
return :pass if result.success?
1313

1414
extract_messages(

lib/overcommit/hook/pre_commit/slim_lint.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class SlimLint < Base
88
end
99

1010
def run
11-
result = execute(command + applicable_files)
11+
result = execute(command, args: applicable_files)
1212
return :pass if result.success?
1313

1414
extract_messages(

lib/overcommit/hook/pre_commit/sqlint.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Sqlint < Base
1010
end
1111

1212
def run
13-
result = execute(command + applicable_files)
13+
result = execute(command, args: applicable_files)
1414
output = result.stdout.chomp
1515
return :pass if result.success? && output.empty?
1616

lib/overcommit/hook/pre_commit/standard.rb

+5-3
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@ module Overcommit::Hook::PreCommit
33
#
44
# @see https://github.com/feross/standard
55
class Standard < Base
6+
MESSAGE_REGEX = /^\s*(?<file>(?:\w:)?[^:]+):(?<line>\d+)/
7+
68
def run
7-
result = execute(command + applicable_files)
9+
result = execute(command, args: applicable_files)
810
output = result.stdout.chomp
911
return :pass if result.success? && output.empty?
1012

1113
# example message:
1214
# path/to/file.js:1:1: Error message (ruleName)
1315
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
1618
)
1719
end
1820
end

lib/overcommit/hook/pre_commit/travis_lint.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit
44
# @see https://github.com/travis-ci/travis.rb
55
class TravisLint < Base
66
def run
7-
result = execute(command + applicable_files)
7+
result = execute(command, args: applicable_files)
88
return :pass if result.success?
99

1010
[:fail, (result.stdout + result.stderr).strip]

lib/overcommit/hook/pre_commit/vint.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit
44
# @see https://github.com/Kuniwak/vint
55
class Vint < Base
66
def run
7-
result = execute(command + applicable_files)
7+
result = execute(command, args: applicable_files)
88
return :pass if result.success?
99

1010
return [:fail, result.stderr] unless result.stderr.empty?

lib/overcommit/hook/pre_commit/xml_lint.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class XmlLint < Base
66
MESSAGE_REGEX = /^(?<file>(?:\w:)?[^:]+):(?<line>\d+):/
77

88
def run
9-
result = execute(command + applicable_files)
9+
result = execute(command, args: applicable_files)
1010
output = result.stderr.chomp
1111

1212
return :pass if result.success? && output.empty?

0 commit comments

Comments
 (0)