def check_hook_name_format(hash)
      errors = []

      Overcommit::Utils.supported_hook_type_classes.each do |hook_type|
        hash.fetch(hook_type) { {} }.each_key do |hook_name|
          next if hook_name == 'ALL'

          unless hook_name.match?(/\A[A-Za-z0-9]+\z/)
            errors << "#{hook_type}::#{hook_name} has an invalid name " \
                      "#{hook_name}. It must contain only alphanumeric " \
                      'characters (no underscores or dashes, etc.)'
          end
        end
      end

      if errors.any?
        if @log
          @log.error errors.join("\n")
          @log.newline
        end
        raise Overcommit::Exceptions::ConfigurationError,
              'One or more hooks had invalid names'
      end
    end
def check_hook_name_format(hash)
      errors = []

      Overcommit::Utils.supported_hook_type_classes.each do |hook_type|
        hash.fetch(hook_type) { {} }.each_key do |hook_name|
          next if hook_name == 'ALL'

          unless hook_name.match?(/\A[A-Za-z0-9]+\z/)
            errors << "#{hook_type}::#{hook_name} has an invalid name " \
                      "#{hook_name}. It must contain only alphanumeric " \
                      'characters (no underscores or dashes, etc.)'
          end
        end
      end

      if errors.any?
        if @log
          @log.error errors.join("\n")
          @log.newline
        end
        raise Overcommit::Exceptions::ConfigurationError,
              'One or more hooks had invalid names'
      end
    end
Prints an error message and raises an exception if a hook has an
 invalid name, since this can result in strange errors elsewhere.