class ERBLint::Linters::BaseLinter
def run(processed_source)
def run(processed_source) @total_offenses = 0 @offenses_not_corrected = 0 (tags, tag_tree) = build_tag_tree(processed_source) tags.each do |tag| next if tag.closing? next if self.class::TAGS&.none?(tag.name) classes = tag.attributes["class"]&.value&.split(" ") || [] tag_tree[tag][:offense] = false next if (classes & self.class::DISALLOWED_CLASSES).any? next unless self.class::CLASSES.blank? || (classes & self.class::CLASSES).any? args = map_arguments(tag, tag_tree[tag]) correction = correction(args) attributes = tag.attributes.each.map(&:name).join(" ") matches_required_attributes = self.class::REQUIRED_ARGUMENTS.blank? || self.class::REQUIRED_ARGUMENTS.all? { |arg| attributes.match?(arg) } tag_tree[tag][:offense] = true tag_tree[tag][:correctable] = matches_required_attributes && !correction.nil? tag_tree[tag][:message] = message(args, processed_source) tag_tree[tag][:correction] = correction end tag_tree.each do |tag, h| next unless h[:offense] @total_offenses += 1 # We always fix the offenses using blocks. The closing tag corresponds to `<% end %>`. if h[:correctable] add_correction(tag, h) else @offenses_not_corrected += 1 generate_offense(self.class, processed_source, tag, h[:message]) end end counter_correct?(processed_source) dump_data(processed_source) if ENV["DUMP_LINT_DATA"] == "1" end