False positive for `Style/RedundantArgument`
t-mario-y opened this issue · comments
t-mario-y commented
Expected behavior
String#chomp
method for '\n'
(single quoted) should not be affected by Style/RedundantArgument
cop, because special treatment in this method is "\n"
(double quoted).
Actual behavior
Single quoted '\n'
is also detected offence after this commit: 8b3656d
Steps to reproduce the problem
Targetting example Ruby file like contains 'foo'.chomp('\n')
:
bundle ex rubocop --only Style/RedundantArgument single_quote_chomp.rb
Result:
Inspecting 1 file
C
Offenses:
single_quote_chomp.rb:1:12: C: [Correctable] Style/RedundantArgument: Argument '\n' is redundant because it is implied by default.
'foo'.chomp('\n')
^^^^^^
RuboCop version
$ [bundle exec] rubocop -V
1.62.1 (using Parser 3.3.0.5, rubocop-ast 1.31.2, running on ruby 3.1.4) [x86_64-linux]
- rubocop-dependency 0.1.2
- rubocop-factory_bot 2.25.1
- rubocop-performance 1.20.2
- rubocop-rails 2.24.0
- rubocop-rspec 2.27.1
- rubocop-sorbet 0.7.8
- rubocop-thread_safety 0.5.1