09/12/2019, 7:55 PM
Hi! I have a question about a discrepency I'm seeing between KtLint and the IDE when I reformat code. I have a file that has a few lines that are over 100 characters. If I use Android Studio to reformat the file, it will correct all of those - either chunking down parameters or putting assignments on a new line, whatever I need. It appears KtLint doesn't do the same. This came up because we ran KtLint against the entire project hoping to get a "clean slate" more or less with formatting, but now we're finding sometimes that when we use the IDE to reformat entire files are changing again. I was expecting that both formatting tools would give me the same output. I just want to confirm that KtLint doesn't do anything to wrap those long lines? If that's correct, does anyone have recommendations for how I can get more consistency between the two?
One option I'm considering looking into, if KtLint truly can't fix it, is to try and run the IDE's version of my auto formatter in my pre-commit hooks as well.

Sha Sha Chu

09/12/2019, 8:09 PM
Hi! The short answer is that it's a hard problem :)
We don't currently support autocorrection of line length violations


09/12/2019, 8:14 PM
Thanks! So I will just have to let my team know this is expected behavior right now. We will probably look into ways to run the IDE format across them automatically in the mean time.