Skip to content

False positive for Style/RedundantArgument #12794

@t-mario-y

Description

@t-mario-y

Expected behavior

String#chompmethod 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy