Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid offense/autocorrect for Style/RedundantLineContinuation #12726

Closed
pjg opened this issue Feb 29, 2024 · 1 comment · Fixed by #12728
Closed

Invalid offense/autocorrect for Style/RedundantLineContinuation #12726

pjg opened this issue Feb 29, 2024 · 1 comment · Fixed by #12728
Labels

Comments

@pjg
Copy link
Contributor

pjg commented Feb 29, 2024

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
@pjg pjg changed the title Invalid offense/autocorrect for Style/RedundantLineContinuation Invalid offense/autocorrect for Style/RedundantLineContinuation Feb 29, 2024
@bquorning bquorning added the bug label Feb 29, 2024
@bquorning
Copy link
Contributor

cc @koic, it’s probably related to #12678.

koic added a commit to koic/rubocop that referenced this issue Feb 29, 2024
…inuation`

Fixes rubocop#12726.

This PR fixes a false positive for `Style/RedundantLineContinuation`
when using line concatenation and calling a method with keyword arguments without parentheses.
koic added a commit that referenced this issue Mar 1, 2024
…dundant_line_continuation

[Fix #12726] Fix a false positive for `Style/RedundantLineContinuation`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants