Skip to content
This repository has been archived by the owner on Aug 29, 2024. It is now read-only.

False positive with Style/RedundantParantheses #18

Closed
eneagoe opened this issue Oct 16, 2023 · 6 comments · Fixed by #19
Closed

False positive with Style/RedundantParantheses #18

eneagoe opened this issue Oct 16, 2023 · 6 comments · Fixed by #19

Comments

@eneagoe
Copy link

eneagoe commented Oct 16, 2023

It looks like we have a false positive with this cop:

app/views/layouts/_navigation.slim:34:25: C: [Correctable] Style/RedundantParentheses: Don't use parentheses around a logical expression.

The line in question is

    a.navbar-brand href=(current_customer&.logo_url.presence || root_path)

Without the parantheses we break the template, so they are definitely not redundant.

@r7kamura
Copy link
Owner

Thanks for reporting, you're absolutely right 👍
I think it would be reasonable to change the default.yml to disable this cop, what do you think?

@eneagoe
Copy link
Author

eneagoe commented Oct 16, 2023

I agree - it would be very difficult to figure out when we can safely apply it.

@r7kamura
Copy link
Owner

@eneagoe
Copy link
Author

eneagoe commented Oct 16, 2023

Beautiful, thank you!

@eneagoe
Copy link
Author

eneagoe commented Oct 16, 2023

Actually there might be another issue - it looks like there's a typo somewhere - it should be Style/RedundantParentheses instead of Style/RedundantParantheses, sorry about that!

@r7kamura
Copy link
Owner

wow, I'll fix that soon 🤣

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants