class RuboCop::Cop::Discourse::NoNokogiriHtmlFragment

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>")

Constants

MSG

Public Instance Methods

on_send(node) click to toggle source
# File lib/rubocop/cop/discourse/no_nokogiri_html_fragment.rb, line 24
def on_send(node)
  return if !using_nokogiri_html_fragment?(node)
  add_offense(node, message: MSG)
end