Class: Overcommit::ConfigurationValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/overcommit/configuration_validator.rb

Overview

Validates and normalizes a configuration.

Instance Method Summary collapse

Instance Method Details

#validate(config, hash, options) ⇒ Hash

Validates hash for any invalid options, normalizing where possible.


13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/overcommit/configuration_validator.rb', line 13

def validate(config, hash, options)
  @options = options.dup
  @log = options[:logger]

  hash = convert_nils_to_empty_hashes(hash)
  ensure_hook_type_sections_exist(hash)
  check_hook_name_format(hash)
  check_hook_env(hash)
  check_for_missing_enabled_option(hash) unless @options[:default]
  check_for_too_many_processors(config, hash)
  check_for_verify_plugin_signatures_option(hash)

  hash
end