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

Rule Proposal: Explicit Boolean Precedence with Parentheses #371

Open
KamasamaK opened this issue Jul 27, 2017 · 1 comment
Open

Rule Proposal: Explicit Boolean Precedence with Parentheses #371

KamasamaK opened this issue Jul 27, 2017 · 1 comment
Milestone

Comments

@KamasamaK
Copy link
Collaborator

KamasamaK commented Jul 27, 2017

Incorrect use of order of operations is a pitfall I've seen a number of programmers fall into, and a linter would be perfect to suggest use of parentheses in those cases. This would not just be to prevent logic mistakes, but also clarify to anyone who does not have the order of precedence memorized. As such, I would expect this to be INFO or lower severity.

This would be triggered for expressions containing operators with mixed precedence-level without parentheses around sub-expressions.

Boolean operations

It should work for any conditionals such as those found in if, else if, while, for, <cfif>, <cfelseif>, cfloop.

Examples

foo OR bar AND xyz

Math operations

TODO?

References

@TheRealAgentK TheRealAgentK added this to the 1.3.0 milestone Jul 27, 2017
@TheRealAgentK
Copy link
Collaborator

For a start, look into combinations of and / or without ()

@cflint cflint deleted a comment from ryaneberly Aug 9, 2017
@ryaneberly ryaneberly modified the milestones: 1.3.0, 1.4.0 Dec 24, 2017
@KamasamaK KamasamaK modified the milestones: 1.4.0, 3.0 May 7, 2018
@KamasamaK KamasamaK changed the title Rule Proposal: Explicit Precedence Rule Proposal: Explicit Boolean Precedence with Parentheses May 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants