def apply_rules(json, type, rules)
      rules.each do |rule|
        next unless rule.function.call(json)
        rule.metadata = json
        rule.type = type

        case rule.modifier
        when :warning
          warnings << rule
        when :error
          errors << rule
        end
      end
    end
def apply_rules(json, type, rules)
      rules.each do |rule|
        next unless rule.function.call(json)
        rule.metadata = json
        rule.type = type

        case rule.modifier
        when :warning
          warnings << rule
        when :error
          errors << rule
        end
      end
    end
Runs the rule, if it fails then additional metadata
 is added to the rule (for printing later) and it's
 added to either `warnings` or `errors`.