Sha256: 8b6177875a88b900ec9eb9ffb0c220398757bc9b5c884fef9612a01c4c4ee365
Contents?: true
Size: 831 Bytes
Versions: 5
Compression:
Stored size: 831 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop module Discourse # Do not use Nokogiri::HTML.fragment # Instead use Nokogiri::HTML5.fragment, which is using Nokogumbo parser # # @example # # bad # Nokogiri::HTML.fragment("<p>test</p>") # # # good # Nokogiri::HTML5.fragment("<p>test</p>") class NoNokogiriHtmlFragment < Base MSG = "Nokogiri::HTML.fragment is deprecated and should not be used." def_node_matcher :using_nokogiri_html_fragment?, <<-MATCHER (send (const (const nil? :Nokogiri) :HTML) :fragment ...) MATCHER def on_send(node) return if !using_nokogiri_html_fragment?(node) add_offense(node, message: MSG) end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems