Refactor check_nokogiri in msftidy