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
Don't use ternary as an alternative for if else #2358
Labels
Comments
I'd suggest not allow to call functions in the 2nd and 3rd part that return |
And I'd make this rule disabled by default 'cause it's quite exotic behavior for C/Objective-C/Swift and many people may want to use it as they used to. |
marcelofabri
added a commit
that referenced
this issue
Feb 8, 2020
marcelofabri
added a commit
that referenced
this issue
Feb 8, 2020
marcelofabri
added a commit
that referenced
this issue
Feb 8, 2020
* Add `void_function_in_ternary` opt-in rule Fixes #2358 * Remove unused import and improve description
marcelofabri
added a commit
that referenced
this issue
Feb 8, 2020
marcelofabri
added a commit
that referenced
this issue
Feb 8, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Rule Request
the community thinks about this.
Ternary operator should be used just on right side of assignment or in return statement. And should not be used as an alternative for
if/else
. As it is very unusual and harder to read than usualif/else
https://softwareengineering.stackexchange.com/a/294560
No parameters expected
It can be enabled by default
The text was updated successfully, but these errors were encountered: