lib/overcommit/hook/pre_commit/jsxcs.rb in overcommit-0.19.0 vs lib/overcommit/hook/pre_commit/jsxcs.rb in overcommit-0.20.0

- old
+ new

@@ -5,24 +5,16 @@ def run result = execute(%W[#{executable} --reporter=inline] + applicable_files) return :pass if result.success? if result.status == 1 + # No configuration found return :warn, result.stderr.chomp end - # Keep lines from the output for files that we actually modified - error_lines, warning_lines = result.stdout.split("\n").partition do |output_line| - if match = output_line.match(/^([^:]+):[^\d]+(\d+)/) - file = match[1] - line = match[2] - end - modified_lines(file).include?(line.to_i) - end - - return :fail, error_lines.join("\n") unless error_lines.empty? - - [:warn, "Modified files have lints (on lines you didn't modify)\n" << - warning_lines.join("\n")] + extract_messages( + result.stdout.split("\n"), + /^(?<file>[^:]+):[^\d]+(?<line>\d+)/, + ) end end end