Skip to content

Invalid offense/autocorrect for Style/RedundantLineContinuation #12726

@pjg

Description

@pjg

Expected behavior

Not to flag the Style/RedundantLineContinuation offense.

Actual behavior

Offense is flagged and incorrectly autocorrected.

Steps to reproduce the problem

Input:

expect(cart).to include \
  plan: 'plan',
  coupon: nil,
  item: nil

This is flagged as:

Style/RedundantLineContinuation: Redundant line continuation.
        expect(cart).to include \ ...

Output after autocorrecting:

expect(cart).to include
  plan: 'plan',
  coupon: nil,
  item: nil

Which is no longer valid Ruby code.

RuboCop version

$ [bundle exec] rubocop -V
1.61.0 (using Parser 3.3.0.5, rubocop-ast 1.30.0, running on ruby 3.1.4) [arm64-darwin22]
  - rubocop-factory_bot 2.25.1
  - rubocop-performance 1.20.2
  - rubocop-rails 2.23.1
  - rubocop-rspec 2.26.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