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

Conflict between Style/RedundantParentheses and Style/ParenthesesAroundCondition #12537

Closed
AlexWayfer opened this issue Dec 14, 2023 · 0 comments · Fixed by #12544
Closed

Conflict between Style/RedundantParentheses and Style/ParenthesesAroundCondition #12537

AlexWayfer opened this issue Dec 14, 2023 · 0 comments · Fixed by #12544
Labels

Comments

@AlexWayfer
Copy link
Contributor

Expected behavior

No offenses from Style/RedundantParentheses when I have Style/ParenthesesAroundCondition with AllowInMultilineConditions: true.

Actual behavior

There is an offense:

image

Steps to reproduce the problem

if (
  interaction.request.uri.include?('streams/key') &&
    interaction.response.headers['content-type']
      &.any? { |type| type.include?('application/json') }
)
  # ...
end
Style/ParenthesesAroundCondition:
  AllowInMultilineConditions: true

RuboCop version

Include the output of rubocop -V or bundle exec rubocop -V if using Bundler.
If you see extension cop versions (e.g. rubocop-performance, rubocop-rspec, and others)
output by rubocop -V, include them as well. Here's an example:

1.59.0 (using Parser 3.2.2.4, rubocop-ast 1.30.0, running on ruby 3.2.2) [x86_64-linux]
  - rubocop-performance 1.19.1
  - rubocop-rake 0.6.0
  - rubocop-rspec 2.24.1
@koic koic added the bug label Dec 15, 2023
koic added a commit to koic/rubocop that referenced this issue Dec 15, 2023
Fixes rubocop#12537.

This PR fixes false positives for `Style/RedundantParentheses`
when `AllowInMultilineConditions: true` of `Style/ParenthesesAroundCondition`.
koic added a commit to koic/rubocop that referenced this issue Dec 15, 2023
Fixes rubocop#12537.

This PR fixes false positives for `Style/RedundantParentheses`
when `AllowInMultilineConditions: true` of `Style/ParenthesesAroundCondition`.
koic added a commit that referenced this issue Dec 16, 2023
…_parentheses

[Fix #12537] Fix false positives for `Style/RedundantParentheses`
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