we use kotlin primarily for server side code and k...
# announcements
s
we use kotlin primarily for server side code and ktlint seems a bit restrictive with it’s quirky rules because of android
m
Use #C88E12QH4 instead. I do for server side and very happy. Integrates into gradle build really well and integration with Sonarqube if you use it.
s
Thanks Mike
is there a way for detekt to not use ktlint - there doco suggests it wraps over ktlint
m
I’ve never dug into how it works. If anything, it might leverage some processing of ktlint, but it has it’s own list of validations. It doesn’t make any recommendations that I’ve seen related to Android. What are your concerns?
p
I use ktlint with server side code without issues. What rules are the the ones you find quirky?
👆 1
I want more rules so I am planning to switch to #C88E12QH4, but I have no problems with #ktlint as such
s
rules such as wildcard imports and indentation for spring service level classes which have many private vals autowired
p
Well, wildcard imports rule is a religious question. I happen to like it, but I understand that some people hate it. Both groups are completely convinced that they are completely right
regarding indentation, I am not sure what you mean
if you want wildcard imports you can suppress them
Also, for some ktlint properties, they support
.editorconfig
config. I am pretty sure they would do it for other features if you come bringing a PR
s
I meant something like this
Copy code
fun foo(bar: Array<Any>, manyBars: List<Any>, tooManyBars: List<Pair<Double, String>>, wayTooManyBars: String): Array<Any>
vs something like this
Copy code
fun foo(
        bar: Array<Any>,
        manyBars: List<Any>,
        tooManyBars: List<Pair<Double, String>>,
        wayTooManyBars: String
    ): Array<Any>
which is much nicer to read for functions or classes with a lot of constructor params in legacy code, and is also officially recomendded by the kotlin style guide and I couldn’t find a way to disable it in ktlint
but I do see your point too