Class: Overcommit::GitHook::CoffeeLint

Inherits:
HookSpecificCheck show all
Includes:
HookRegistry
Defined in:
lib/overcommit/plugins/pre_commit/coffee_lint.rb

Instance Method Summary collapse

Methods included from HookRegistry

included

Methods inherited from HookSpecificCheck

file_type, friendly_name, #initialize, #name, required!, #skip?, skippable?, #staged, stealth!, #stealth?

Constructor Details

This class inherits a constructor from Overcommit::GitHook::HookSpecificCheck

Instance Method Details

#run_checkObject



6
7
8
9
10
11
12
13
14
# File 'lib/overcommit/plugins/pre_commit/coffee_lint.rb', line 6

def run_check
  unless in_path? 'coffeelint'
    return :warn, 'Run `npm install -g coffeelint`'
  end

  paths  = staged.collect(&:path).join(' ')
  output = `coffeelint --quiet #{paths}`.split("\n")
  return ($?.success? ? :good : :bad), output
end