-
Notifications
You must be signed in to change notification settings - Fork 506
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
[Android] Return type allowed on separate line #941
Comments
Actually, I think this applies to non-android usage as well. (style guide) |
I agree that this is not adroid specific. With max-line-length set to 50, the generated output is as follows:
In this case the parameter-list-wrapping rule forces the parameters to separate lines. Note however that the return type should be placed on the same line as the closing parentheses and colon. But also IntelliJ does not fix this mistake. For example with max-line-length set to 100, the generated output is as follows:
Also the IntelliJ default formatting does not reformat this statement. So the behavior of ktlint is consistent with IntelliJ default formatting. Technically it is not a bug in the current ktlint rules. I am creating a new rule
|
OP states that example below should not result in an error:
According to examples in Kotlin coding conventions and Android's Kotlin Styleguide the closing parenthesis and return type should be on the same line. This is also the style that is is used by rule |
Actually I said that it should result in an error. But yes, it looks like this is properly addressed with |
Yes, at some point in time it will become standard. But it depends on the feedback that we receive about the rule. |
Ktlint in Android mode allows the return type of a function signature to be on a separate line when the parameters are not on their own lines.
The Android Style Guide says (link):
It seems like ktlint does not consider the return type to be part of the function signature.
Example / Steps to Reproduce
Expected Behavior
Ktlint should detect that the function signature does not fit on one line and give error(s) that the parameters are not on their own line.
Observed Behavior
No error.
Your Environment
The text was updated successfully, but these errors were encountered: