Hi! We have an existing project which uses kotlin ...
# ktlint
Hi! We have an existing project which uses kotlin and we’re looking to use ktlint for it. However, the existing files are not properly formatted and lint checks fail for them on running
task. Is there any way to: 1. whitelist a few files so that checks aren’t run for them? 2. un-whitelist the file once some changes have been made to it? Thanks
Is there any reason why you don't want to just run it with the formatting option on? It will autocorrect most issues
It is not auto-correcting the indentation issues, and there are a lot of them 😅 One option is to format the entire
source directory from android studio, but that’ll be very difficult to review.
The latest version of ktlint supports disabling rules via the .editorconfig file. You should be able to use it to disable rules for particular paths
👍 2
🙏 1
I'm away from my computer atm but take a look at the README for details
If it doesn't work, feel free to open a ticket on the github
Also, fyi the experimental indentation rule does support autocorrection
You can pass --experimental on the command line to try it out
Thanks. Will try that and let you know 🙂
you could also suppress particular violation in the code: https://github.com/pinterest/ktlint/#how-do-i-suppress-an-error-for-a-lineblockfile