Class: Overcommit::GitHook::YamlSyntax
- Inherits:
-
HookSpecificCheck
- Object
- HookSpecificCheck
- Overcommit::GitHook::YamlSyntax
- Includes:
- HookRegistry
- Defined in:
- lib/overcommit/plugins/pre_commit/yaml_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
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/overcommit/plugins/pre_commit/yaml_syntax.rb', line 8 def run_check clean = true output = [] staged.each do |staged_file| begin YAML.load_file(staged_file.path) rescue ArgumentError => e output << "#{e.} parsing #{staged_file.path}" clean = false end end return (clean ? :good : :bad), output end |