Skip to content

Commit

Permalink
Increase performance of PhpCs pre commit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
websi authored and sds committed Feb 5, 2020
1 parent 97e8610 commit dc50788
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions lib/overcommit/hook/pre_commit/php_cs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,14 @@ class PhpCs < Base
def run
messages = []

applicable_files.each do |file|
result = execute(command, args: [file])
if result.status
rows = result.stdout.split("\n")

# Discard the csv header
rows.shift

# Push each of the errors in the particular file into the array
rows.map do |row|
messages << row
end
end
result = execute(command, args: applicable_files)
if result.status
messages = result.stdout.split("\n")
# Discard the csv header
messages.shift
end

return :fail if messages.empty? && !result.success?
return :pass if messages.empty?

parse_messages(messages)
Expand Down

0 comments on commit dc50788

Please sign in to comment.