audit

in gitlab_rb_loader.rb [8:34]


    def audit(reference_rb, actual_rb)
      errors = []

      actual_rb.flat_hash.each do |name, actual|
        next unless reference_rb.flat_hash.key?(name)

        expected = reference_rb.flat_hash[name]
        e = GitlabRbLoader.audit_value(name, expected, actual)
        errors += e unless e.empty?
      end

      
      extra_names = actual_rb.flat_hash.keys - reference_rb.flat_hash.keys
      unless extra_names.empty?
        errors << "ERROR: gitlab.rb has extraneous config values that do not exist in reference\n"
        extra_names.each { |n| errors << "  #{n} = #{actual_rb.flat_hash[n]}\n" }
      end

      missing_names = reference_rb.flat_hash.keys - actual_rb.flat_hash.keys
      unless missing_names.empty?
        errors << "ERROR: gitlab.rb missing config values that are specified in the reference:\n"
        missing_names.each { |n| errors << "  Missing: #{n} = #{reference_rb.flat_hash[n]}\n" }
      end

      errors
    end