-
Notifications
You must be signed in to change notification settings - Fork 503
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
'If' should force curly braces #174
Comments
Hi @jasondhl. |
Thanks for the prompt reply @shyiko ! Not very sure how to go about adding this Rule, but I'll check it out. |
@jasondhl take a look inside https://github.com/shyiko/ktlint/tree/master/ktlint-ruleset-standard and https://github.com/shyiko/ktlint#ast (that's more or less all there is to it). |
@jkaan that would be great! |
This rule was contributed by @yokotaso (thank you, Tomoya!). It will be included in the next release. |
I'm reopening the issue as auto-correction isn't quite there yet. |
I can try to add auto-correction |
@AleksandrSl that would be awesome! (here is a little bit of context) |
Can I rely on |
As stated in the Android Kotlin Style Guide under Formatting, even if an
If
statement have only one line, it should be surrounded by a curly brace.In my project, my code:
was deemed acceptable by ktlint. Is there anything I can do short of writing my own rule? Thanks in advance.
The text was updated successfully, but these errors were encountered: