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.

Parameters:

  • config (Overcommit::Configuration)
  • hash (Hash)

    hash representation of YAML config

  • options (Hash)
  • default (Hash)

    a customizable set of options

  • logger (Hash)

    a customizable set of options

Returns:

  • (Hash)

    validated hash (potentially modified)



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

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