Skip to content

Android: Use same formatting setup for Android Studio formatting and Detekt #4663

Answered by schalkms
MarcLFJ asked this question in Q&A
Discussion options

You must be logged in to vote

There exists no guide on how to align detekt-formatting with IDEA formatting, to my knowledge.
There are two solutions that I can think of.

  1. You decide for one or the other formatting tool.
    Arguably, those formatting tools differ quite a bit starting with the configuration file. Furthermore, I think it's rather a seldom use case to have two formatting tools in the same project.

  2. You write a custom 3rd party detekt ruleset that reads the IDEA config file and configures the formatting rules of detekt according to the xml attributes you need.
    detekt-formatting wraps ktlint rules, which can be configured in detekt but not in plain ktlint. You could take a look at the implementation in the m…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by cortinico
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants