-
-
Notifications
You must be signed in to change notification settings - Fork 88
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Steps to reproduce the problem
- Create file with code
code.rb:
# frozen_string_literal: true
require 'nokogiri'
html_doc = Nokogiri::HTML("<html data='value'><body><h1>Mr. Belvedere Fan Club</h1></body></html>")
puts html_doc.xpath('//html').attr('data')
and .rubocop.yml:
require:
- rubocop-performance
AllCops:
NewCops: enable
- run it - it will return
value:
$ ruby code.rb
value
rubocop -A:
rubocop -A
Inspecting 1 file
C
Offenses:
code.rb:6:36: C: [Corrected] Performance/StringIdentifierArgument: Use :data instead of 'data'.
puts html_doc.xpath('//html').attr('data')
^^^^^^
1 file inspected, 1 offense detected, 1 offense corrected
- run file - it will fail
.rvm/gems/ruby-3.0.3/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node_set.rb:209:in `attribute': no implicit conversion of Symbol into String (TypeError)
RuboCop version
$ [bundle exec] rubocop -V
1.24.0 (using Parser 3.0.3.2, rubocop-ast 1.15.0, running on ruby 3.0.3 x86_64-linux)
- rubocop-performance 1.13.0
gildesmarais
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working