Method: PreCommit::Configuration#enable

Defined in:
lib/pre-commit/configuration.rb

#enable(plugin_name, type, check1, *checks) ⇒ Object



31
32
33
34
35
36
37
38
39
40
# File 'lib/pre-commit/configuration.rb', line 31

def enable(plugin_name, type, check1, *checks)
  checks.unshift(check1) # check1 is ArgumentError triger
  checks.map!(&:to_sym)
  @providers.update( plugin_name, "#{type}_remove", :-, checks )
  @providers.update( plugin_name, "#{type}_add",    :+, (checks or []) - (@providers.default(type) or []) )
  true
rescue PreCommit::PluginNotFound => e
  $stderr.puts e
  false
end