Class: Overcommit::GitHook::RubySyntax
- Inherits:
-
HookSpecificCheck
- Object
- HookSpecificCheck
- Overcommit::GitHook::RubySyntax
- Includes:
- HookRegistry
- Defined in:
- lib/overcommit/plugins/pre_commit/ruby_syntax.rb
Instance Method Summary collapse
Methods included from HookRegistry
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_check ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/overcommit/plugins/pre_commit/ruby_syntax.rb', line 6 def run_check clean = true output = [] staged.each do |staged| syntax = `ruby -c #{staged.path} 2>&1` unless $?.success? output += syntax.lines.to_a clean = false end end return (clean ? :good : :bad), output end |