-
Notifications
You must be signed in to change notification settings - Fork 38
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
Warn on expressions that contain logical operators but no braces #313
Comments
The proposed implementation in #510 catches a lot of issues which could be considered false positives and be more of a nuisance than helpful. For example, the following expressions seem very clear without parantheses. Yet this rule complains about them. puts message || "no message"
printf "%s, %d\n", message || "no message", 1 Part of the reason is of course that I wouldn't consider it completely inadequate to require adding parentheses in these cases. But I'm not convinced it should be necessary to do so. The example from the OP of course would certainly benefit from a complaint about missing parenthesis. |
That's valid, thank you for the feedback. Maybe it can be narrowed down to a Call for each args where if any arg is BinaryOp, and the right of that is another Call with a BinaryOp. A little specific, but maybe that'd be fine? |
I agree with @straight-shoota. We can start with a narrow scope and expand it later if needed. |
A pretty mean (and probably common) trap:
Can easily go unnoticed even with test-coverage.
I think it would be great if ameba would warn about it.
The text was updated successfully, but these errors were encountered: