facebook / ktfmt

A program that reformats Kotlin source code to comply with the common community standard for Kotlin code conventions.
https://facebook.github.io/ktfmt/
Apache License 2.0
857 stars 66 forks source link

Indentation level should be a command-line argument #443

Closed notfed closed 3 weeks ago

notfed commented 3 months ago

Defaulting to 2-spaces is a bit...odd. If you really insist on 2-spaces, provide a separate command-line argument to override this.

Your README says:

--dropbox-style makes ktfmt use a block indent of 4 spaces instead of 2. See below for details.

Note: There is no configurability as to the formatter's algorithm for formatting (apart from --dropbox-style). This is a deliberate design decision to unify our code formatting on a single format.

But...both kotlinlang.com and Google recommend 4-space indentation for Kotlin.

hick209 commented 3 months ago

What are you suggesting to be done here? Change the default to 4 spaces?

You could specify --kotlinlang-style to use the Kotlin recommended one. We do not have the intention to change the default.

FWIW Google uses 2 space formatting for their code as well (see the --google-style), the one you mentioned is the Android recommendation, which is different from how they write their code internally.

hick209 commented 3 weeks ago

Closed due to lack of response