Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You wrote this entire comment but ktlint can generate a .editorconfig (and in fact used to generate a IntelliJ specific config file) which is a universal way of solving this exact problem.

Pretty sure the FB equivalent also has a matching .editorconfig

Also you could just setup a prepush hook so they run before your CI does which afaik both give you examples of.



I use pre-commit/pre-push hooks to apply formatters like Spotless/ktfmt etc, it's too much work to try to fight Intellij's formatting.

There's a ktfmt IntelliJ plugin that does work most of the time IME, if you're willing to give it a shot.


My auto-generated config has been pretty solid

The only time the pre-push hook fails is if a line is too long and there's no "canonical" way to fix it (so it'll create a method chain for example, but it won't do string concatenation since there's N ways to break a string across lines)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: