-
Notifications
You must be signed in to change notification settings - Fork 68
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
One parameter per line if function prototype doesn't fit entirely in one line #13
Comments
I'd expect the output to be:
|
@cgrushko |
ktfmt and detekct/ktlint disagree, so some friction between the linters is expected (we plan to disable detekt's formatting on files that ktfmt formats). Again, we could change this formatting decision. I don't have a good sense of what's right to do. |
I think I agree with Carmi's expected style. We should disable some of Detekt's checks to match with this. |
Google's Kotlin style guide for Android says arguments should be split across multiple lines if the function signature doesn't fit on one line. JetBrains' official Kotlin style guide is fuzzier; it says "closely related" arguments should be placed on the same line, but obviously ktfmt can't determine that. |
My personal preference is to put all parameters in one line. Browsing Hack
code, which uses one parameter per line, is annoying to me because
parameters dominate the vertical space (ie, all I see while scrolling is
parameters).
Could be that it just needs getting used to, but we do expect lots of
interoperability with Java, so making it similar to java has its merits.
…On Thu, Jan 2, 2020 at 7:26 PM Steven Grimm ***@***.***> wrote:
Google's Kotlin style guide for Android
<https://developer.android.com/kotlin/style-guide#functions> says
arguments should be split across multiple lines if the function signature
doesn't fit on one line. JetBrains' official Kotlin style guide is fuzzier;
it says "closely related" arguments should be placed on the same line, but
obviously ktfmt can't determine that.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#13>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAPH6YK2J4GOYYD7TOJWQ5LQ3YPVFANCNFSM4KBRXEGQ>
.
|
I agree with being similar to java. Would the detekct changes the rule OR ktfmt replace detekct as the lint in diff tool? |
Let’s move the detekt/ktfmt discussion internally.
…On Fri, Jan 3, 2020 at 9:41 PM Trigon ***@***.***> wrote:
I agree with being similar to java. Would the detekct changes the rule OR
ktfmt replace detekct as the lint in diff tool?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#13>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAPH6YLSP2BUAHYUA5FHIB3Q36IFDANCNFSM4KBRXEGQ>
.
|
I'll close this for now. We can revisit this if we run into examples where it's very clearly better to break before each parameter. |
For this one, it should be the right format, but after I use ktfmt, it changes to
Free feel to talk to me directly via workchat wyl@fb
The text was updated successfully, but these errors were encountered: