diff --git a/lib/overcommit/hook/pre_commit/chamber_security.rb b/lib/overcommit/hook/pre_commit/chamber_security.rb index fb77122a..b70148b3 100644 --- a/lib/overcommit/hook/pre_commit/chamber_security.rb +++ b/lib/overcommit/hook/pre_commit/chamber_security.rb @@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit # @see https://github.com/thekompanee/chamber class ChamberSecurity < Base def run - result = execute(command + applicable_files) + result = execute(command, args: applicable_files) return :pass if result.stdout.empty? [:fail, "These settings appear to need to be secured but were not: #{result.stdout}"] diff --git a/lib/overcommit/hook/pre_commit/coffee_lint.rb b/lib/overcommit/hook/pre_commit/coffee_lint.rb index 5f95212d..2f56ca0b 100644 --- a/lib/overcommit/hook/pre_commit/coffee_lint.rb +++ b/lib/overcommit/hook/pre_commit/coffee_lint.rb @@ -15,7 +15,7 @@ class CoffeeLint < Base end def run - result = execute(command + applicable_files) + result = execute(command, args: applicable_files) parse_messages(result.stdout) end diff --git a/lib/overcommit/hook/pre_commit/css_lint.rb b/lib/overcommit/hook/pre_commit/css_lint.rb index 0c34e38e..27ffd7eb 100644 --- a/lib/overcommit/hook/pre_commit/css_lint.rb +++ b/lib/overcommit/hook/pre_commit/css_lint.rb @@ -10,7 +10,7 @@ class CssLint < Base /x def run - result = execute(command + applicable_files) + result = execute(command, args: applicable_files) output = result.stdout.chomp return :pass if result.success? && output.empty? diff --git a/lib/overcommit/hook/pre_commit/es_lint.rb b/lib/overcommit/hook/pre_commit/es_lint.rb index c61641bb..01466b6f 100644 --- a/lib/overcommit/hook/pre_commit/es_lint.rb +++ b/lib/overcommit/hook/pre_commit/es_lint.rb @@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit # @see http://eslint.org/ class EsLint < Base def run - result = execute(command + applicable_files) + result = execute(command, args: applicable_files) output = result.stdout.chomp return :pass if result.success? && output.empty? diff --git a/lib/overcommit/hook/pre_commit/go_lint.rb b/lib/overcommit/hook/pre_commit/go_lint.rb index 8fedde09..e5b93c3b 100644 --- a/lib/overcommit/hook/pre_commit/go_lint.rb +++ b/lib/overcommit/hook/pre_commit/go_lint.rb @@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit # @see https://github.com/golang/lint class GoLint < Base def run - result = execute(command + applicable_files) + result = execute(command, args: applicable_files) output = result.stdout + result.stderr # Unfortunately the exit code is always 0 return :pass if output.empty? diff --git a/lib/overcommit/hook/pre_commit/go_vet.rb b/lib/overcommit/hook/pre_commit/go_vet.rb index 12ed20c6..7ddfa840 100644 --- a/lib/overcommit/hook/pre_commit/go_vet.rb +++ b/lib/overcommit/hook/pre_commit/go_vet.rb @@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit # @see https://godoc.org/code.google.com/p/go-zh.tools/cmd/vet class GoVet < Base def run - result = execute(command + applicable_files) + result = execute(command, args: applicable_files) return :pass if result.success? if result.stderr =~ /no such tool "vet"/ diff --git a/lib/overcommit/hook/pre_commit/haml_lint.rb b/lib/overcommit/hook/pre_commit/haml_lint.rb index 7e2d5f89..f91dc303 100644 --- a/lib/overcommit/hook/pre_commit/haml_lint.rb +++ b/lib/overcommit/hook/pre_commit/haml_lint.rb @@ -8,7 +8,7 @@ class HamlLint < Base end def run - result = execute(command + applicable_files) + result = execute(command, args: applicable_files) return :pass if result.success? extract_messages( diff --git a/lib/overcommit/hook/pre_commit/image_optim.rb b/lib/overcommit/hook/pre_commit/image_optim.rb index 7ef806c6..a4cd75af 100644 --- a/lib/overcommit/hook/pre_commit/image_optim.rb +++ b/lib/overcommit/hook/pre_commit/image_optim.rb @@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit # @see https://github.com/toy/image_optim class ImageOptim < Base def run - result = execute(command + applicable_files) + result = execute(command, args: applicable_files) return [:fail, result.stdout + result.stderr] unless result.success? optimized_files = extract_optimized_files(result.stdout) diff --git a/lib/overcommit/hook/pre_commit/java_checkstyle.rb b/lib/overcommit/hook/pre_commit/java_checkstyle.rb index 439e5131..d4a519d5 100644 --- a/lib/overcommit/hook/pre_commit/java_checkstyle.rb +++ b/lib/overcommit/hook/pre_commit/java_checkstyle.rb @@ -6,7 +6,7 @@ class JavaCheckstyle < Base MESSAGE_REGEX = /^(?(?:\w:)?[^:]+):(?\d+)/ def run - result = execute(command + applicable_files) + result = execute(command, args: applicable_files) output = result.stdout.chomp return :pass if result.success? diff --git a/lib/overcommit/hook/pre_commit/js_hint.rb b/lib/overcommit/hook/pre_commit/js_hint.rb index 62d65fdc..943e64ca 100644 --- a/lib/overcommit/hook/pre_commit/js_hint.rb +++ b/lib/overcommit/hook/pre_commit/js_hint.rb @@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit # @see http://jshint.com/ class JsHint < Base def run - result = execute(command + applicable_files) + result = execute(command, args: applicable_files) output = result.stdout.chomp return :pass if result.success? && output.empty? diff --git a/lib/overcommit/hook/pre_commit/js_lint.rb b/lib/overcommit/hook/pre_commit/js_lint.rb index c0638d00..4e2e6bab 100644 --- a/lib/overcommit/hook/pre_commit/js_lint.rb +++ b/lib/overcommit/hook/pre_commit/js_lint.rb @@ -6,7 +6,7 @@ class JsLint < Base MESSAGE_REGEX = /(?(?:\w:)?[^:]+):(?\d+)/ def run - result = execute(command + applicable_files) + result = execute(command, args: applicable_files) return :pass if result.success? # example message: diff --git a/lib/overcommit/hook/pre_commit/jscs.rb b/lib/overcommit/hook/pre_commit/jscs.rb index e38d16bc..8c4226cc 100644 --- a/lib/overcommit/hook/pre_commit/jscs.rb +++ b/lib/overcommit/hook/pre_commit/jscs.rb @@ -5,7 +5,7 @@ module Overcommit::Hook::PreCommit # @see http://jscs.info/ class Jscs < Base def run - result = execute(command + applicable_files) + result = execute(command, args: applicable_files) return :pass if result.success? if result.status == 1 diff --git a/lib/overcommit/hook/pre_commit/pep257.rb b/lib/overcommit/hook/pre_commit/pep257.rb index 6aeb8b01..339de9ea 100644 --- a/lib/overcommit/hook/pre_commit/pep257.rb +++ b/lib/overcommit/hook/pre_commit/pep257.rb @@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit # @see https://pypi.python.org/pypi/pep257 class Pep257 < Base def run - result = execute(command + applicable_files) + result = execute(command, args: applicable_files) return :pass if result.success? output = result.stderr.chomp diff --git a/lib/overcommit/hook/pre_commit/pep8.rb b/lib/overcommit/hook/pre_commit/pep8.rb index 87d18f9b..954b2f91 100644 --- a/lib/overcommit/hook/pre_commit/pep8.rb +++ b/lib/overcommit/hook/pre_commit/pep8.rb @@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit # @see https://pypi.python.org/pypi/pep8 class Pep8 < Base def run - result = execute(command + applicable_files) + result = execute(command, args: applicable_files) output = result.stdout.chomp return :pass if result.success? && output.empty? diff --git a/lib/overcommit/hook/pre_commit/puppet_lint.rb b/lib/overcommit/hook/pre_commit/puppet_lint.rb index 14c2242f..14d01d9a 100644 --- a/lib/overcommit/hook/pre_commit/puppet_lint.rb +++ b/lib/overcommit/hook/pre_commit/puppet_lint.rb @@ -10,7 +10,7 @@ class PuppetLint < Base end def run - result = execute(command + applicable_files) + result = execute(command, args: applicable_files) output = result.stdout.chomp.gsub(/^"|"$/, '') return :pass if result.success? && output.empty? diff --git a/lib/overcommit/hook/pre_commit/pyflakes.rb b/lib/overcommit/hook/pre_commit/pyflakes.rb index 703e28a5..8c56ef1d 100644 --- a/lib/overcommit/hook/pre_commit/pyflakes.rb +++ b/lib/overcommit/hook/pre_commit/pyflakes.rb @@ -6,7 +6,7 @@ class Pyflakes < Base MESSAGE_REGEX = /^(?(?:\w:)?[^:]+):(?\d+):/ def run - result = execute(command + applicable_files) + result = execute(command, args: applicable_files) return :pass if result.success? errors = get_messages(result.stderr, :error) diff --git a/lib/overcommit/hook/pre_commit/pylint.rb b/lib/overcommit/hook/pre_commit/pylint.rb index 0772e42c..7ef6d57c 100644 --- a/lib/overcommit/hook/pre_commit/pylint.rb +++ b/lib/overcommit/hook/pre_commit/pylint.rb @@ -13,7 +13,7 @@ class Pylint < Base end def run - result = execute(command + applicable_files) + result = execute(command, args: applicable_files) return :pass if result.success? output = result.stdout.chomp diff --git a/lib/overcommit/hook/pre_commit/python_flake8.rb b/lib/overcommit/hook/pre_commit/python_flake8.rb index 0cdbd4d6..8ae893af 100644 --- a/lib/overcommit/hook/pre_commit/python_flake8.rb +++ b/lib/overcommit/hook/pre_commit/python_flake8.rb @@ -13,7 +13,7 @@ class PythonFlake8 < Base end def run - result = execute(command + applicable_files) + result = execute(command, args: applicable_files) return :pass if result.success? output = result.stdout.chomp diff --git a/lib/overcommit/hook/pre_commit/reek.rb b/lib/overcommit/hook/pre_commit/reek.rb index 067e48e7..4574a297 100644 --- a/lib/overcommit/hook/pre_commit/reek.rb +++ b/lib/overcommit/hook/pre_commit/reek.rb @@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit # @see https://github.com/troessner/reek class Reek < Base def run - result = execute(command + applicable_files) + result = execute(command, args: applicable_files) return :pass if result.success? output = scrub_output(result.stdout + result.stderr) diff --git a/lib/overcommit/hook/pre_commit/ruby_lint.rb b/lib/overcommit/hook/pre_commit/ruby_lint.rb index 2b332873..6e0c23da 100644 --- a/lib/overcommit/hook/pre_commit/ruby_lint.rb +++ b/lib/overcommit/hook/pre_commit/ruby_lint.rb @@ -8,7 +8,7 @@ class RubyLint < Base end def run - result = execute(command + applicable_files) + result = execute(command, args: applicable_files) return :pass if result.success? extract_messages( diff --git a/lib/overcommit/hook/pre_commit/scalariform.rb b/lib/overcommit/hook/pre_commit/scalariform.rb index c97d80d2..3822a80e 100644 --- a/lib/overcommit/hook/pre_commit/scalariform.rb +++ b/lib/overcommit/hook/pre_commit/scalariform.rb @@ -6,7 +6,7 @@ class Scalariform < Base MESSAGE_REGEX = /^\[(?FAILED|ERROR)\]\s+(?(?:\w:)?.+)/ def run - result = execute(command + applicable_files) + result = execute(command, args: applicable_files) # example message: # [FAILED] path/to/file.scala diff --git a/lib/overcommit/hook/pre_commit/scalastyle.rb b/lib/overcommit/hook/pre_commit/scalastyle.rb index 3e5e2c3a..d79b5b31 100644 --- a/lib/overcommit/hook/pre_commit/scalastyle.rb +++ b/lib/overcommit/hook/pre_commit/scalastyle.rb @@ -11,7 +11,7 @@ class Scalastyle < Base /x def run - result = execute(command + applicable_files) + result = execute(command, args: applicable_files) output = result.stdout.chomp messages = output.split("\n").grep(MESSAGE_REGEX) return :pass if result.success? && messages.empty? diff --git a/lib/overcommit/hook/pre_commit/scss_lint.rb b/lib/overcommit/hook/pre_commit/scss_lint.rb index a262450d..e6e45f07 100644 --- a/lib/overcommit/hook/pre_commit/scss_lint.rb +++ b/lib/overcommit/hook/pre_commit/scss_lint.rb @@ -8,7 +8,7 @@ class ScssLint < Base end def run - result = execute(command + applicable_files) + result = execute(command, args: applicable_files) # Status code 81 indicates the applicable files were all filtered by # exclusions defined by the configuration. In this case, we're happy to diff --git a/lib/overcommit/hook/pre_commit/semi_standard.rb b/lib/overcommit/hook/pre_commit/semi_standard.rb index 08685e8e..d88afb28 100644 --- a/lib/overcommit/hook/pre_commit/semi_standard.rb +++ b/lib/overcommit/hook/pre_commit/semi_standard.rb @@ -3,16 +3,18 @@ module Overcommit::Hook::PreCommit # # @see https://github.com/Flet/semistandard class SemiStandard < Base + MESSAGE_REGEX = /^\s*(?(?:\w:)?[^:]+):(?\d+)/ + def run - result = execute(command + applicable_files) + result = execute(command, args: applicable_files) output = result.stdout.chomp return :pass if result.success? && output.empty? # example message: # path/to/file.js:1:1: Error message (ruleName) extract_messages( - output.split("\n")[1..-1], # ignore header line - /^\s*(?(?:\w:)?[^:]+):(?\d+)/ + output.split("\n").grep(MESSAGE_REGEX), # ignore header line + MESSAGE_REGEX ) end end diff --git a/lib/overcommit/hook/pre_commit/shell_check.rb b/lib/overcommit/hook/pre_commit/shell_check.rb index 12cf5095..d918c95c 100644 --- a/lib/overcommit/hook/pre_commit/shell_check.rb +++ b/lib/overcommit/hook/pre_commit/shell_check.rb @@ -8,7 +8,7 @@ class ShellCheck < Base end def run - result = execute(command + applicable_files) + result = execute(command, args: applicable_files) return :pass if result.success? extract_messages( diff --git a/lib/overcommit/hook/pre_commit/slim_lint.rb b/lib/overcommit/hook/pre_commit/slim_lint.rb index 6ae191d5..e373bcb5 100644 --- a/lib/overcommit/hook/pre_commit/slim_lint.rb +++ b/lib/overcommit/hook/pre_commit/slim_lint.rb @@ -8,7 +8,7 @@ class SlimLint < Base end def run - result = execute(command + applicable_files) + result = execute(command, args: applicable_files) return :pass if result.success? extract_messages( diff --git a/lib/overcommit/hook/pre_commit/sqlint.rb b/lib/overcommit/hook/pre_commit/sqlint.rb index 14684208..b5cae3c6 100644 --- a/lib/overcommit/hook/pre_commit/sqlint.rb +++ b/lib/overcommit/hook/pre_commit/sqlint.rb @@ -10,7 +10,7 @@ class Sqlint < Base end def run - result = execute(command + applicable_files) + result = execute(command, args: applicable_files) output = result.stdout.chomp return :pass if result.success? && output.empty? diff --git a/lib/overcommit/hook/pre_commit/standard.rb b/lib/overcommit/hook/pre_commit/standard.rb index 29181de3..ae8dfa5d 100644 --- a/lib/overcommit/hook/pre_commit/standard.rb +++ b/lib/overcommit/hook/pre_commit/standard.rb @@ -3,16 +3,18 @@ module Overcommit::Hook::PreCommit # # @see https://github.com/feross/standard class Standard < Base + MESSAGE_REGEX = /^\s*(?(?:\w:)?[^:]+):(?\d+)/ + def run - result = execute(command + applicable_files) + result = execute(command, args: applicable_files) output = result.stdout.chomp return :pass if result.success? && output.empty? # example message: # path/to/file.js:1:1: Error message (ruleName) extract_messages( - output.split("\n")[1..-1], # ignore header line - /^\s*(?(?:\w:)?[^:]+):(?\d+)/ + output.split("\n").grep(MESSAGE_REGEX), # ignore header line + MESSAGE_REGEX ) end end diff --git a/lib/overcommit/hook/pre_commit/travis_lint.rb b/lib/overcommit/hook/pre_commit/travis_lint.rb index b1217e5d..9909a072 100644 --- a/lib/overcommit/hook/pre_commit/travis_lint.rb +++ b/lib/overcommit/hook/pre_commit/travis_lint.rb @@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit # @see https://github.com/travis-ci/travis.rb class TravisLint < Base def run - result = execute(command + applicable_files) + result = execute(command, args: applicable_files) return :pass if result.success? [:fail, (result.stdout + result.stderr).strip] diff --git a/lib/overcommit/hook/pre_commit/vint.rb b/lib/overcommit/hook/pre_commit/vint.rb index e63e81e8..91169e82 100644 --- a/lib/overcommit/hook/pre_commit/vint.rb +++ b/lib/overcommit/hook/pre_commit/vint.rb @@ -4,7 +4,7 @@ module Overcommit::Hook::PreCommit # @see https://github.com/Kuniwak/vint class Vint < Base def run - result = execute(command + applicable_files) + result = execute(command, args: applicable_files) return :pass if result.success? return [:fail, result.stderr] unless result.stderr.empty? diff --git a/lib/overcommit/hook/pre_commit/xml_lint.rb b/lib/overcommit/hook/pre_commit/xml_lint.rb index 1776dfe9..0be13e82 100644 --- a/lib/overcommit/hook/pre_commit/xml_lint.rb +++ b/lib/overcommit/hook/pre_commit/xml_lint.rb @@ -6,7 +6,7 @@ class XmlLint < Base MESSAGE_REGEX = /^(?(?:\w:)?[^:]+):(?\d+):/ def run - result = execute(command + applicable_files) + result = execute(command, args: applicable_files) output = result.stderr.chomp return :pass if result.success? && output.empty?