class Overcommit::Hook::PreCommit::CoffeeLint

Runs ‘coffeelint` against any modified CoffeeScript files.

@see www.coffeelint.org/

Constants

MESSAGE_REGEX
MESSAGE_TYPE_CATEGORIZER

Public Instance Methods

run() click to toggle source
# File lib/overcommit/hook/pre_commit/coffee_lint.rb, line 19
def run
  result = execute(command, args: applicable_files)
  parse_messages(result.stdout)
end

Private Instance Methods

parse_messages(output) click to toggle source
# File lib/overcommit/hook/pre_commit/coffee_lint.rb, line 26
def parse_messages(output)
  output.scan(MESSAGE_REGEX).map do |file, line, type, msg|
    line = line.to_i
    type = MESSAGE_TYPE_CATEGORIZER.call(type)
    text = "#{file}:#{line}:#{type} #{msg}"
    Overcommit::Hook::Message.new(type, file, line, text)
  end
end