https://kotlinlang.org logo
r

Ryan Smith

01/14/2023, 2:20 PM
Hi everyone, any recommendations for tools that can be used either as pre-commit hooks or (preferably) with Github Actions for opinionated code formatting? In the Python world I'm used to Black (https://black.readthedocs.io/en/stable/) which can be used in so many ways to make sure everyone is on the same page w.r.t. code formatting. Is there something like this in the Kotlin world other than making everyone on a project use IntelliJ?
s

Sam

01/14/2023, 2:24 PM
#ktlint has a code formatter
🙌 1
👀 1
r

Ryan Smith

01/14/2023, 2:25 PM
Thanks, Ill pop in there and take a look
e

ephemient

01/14/2023, 4:52 PM
#detekt also has a formatting extension (using ktlint)
👀 1
there's also #ktfmt, which is a lot more opinionated
(I'm using ktlint via kotlinter and detekt on my own projects)
plus1 1
r

Ryan Smith

01/18/2023, 12:43 AM
Wow this is great, thank you @ephemient!
f

Francis Mariano

02/17/2023, 8:06 PM
@ephemient why do you use kotlinter and detekt in your projects??? do they perform different things??
e

ephemient

02/17/2023, 8:07 PM
there is some overlap if you use
detekt-formatting
, but otherwise, they check different things.
f

Francis Mariano

02/17/2023, 8:11 PM
ok, thank you I will try them
2 Views