kotlinter-gradle
kotlinter-gradle copied to clipboard
Incremental task
Hi,
I'm not sure i really understand incremental task. I integrate the plugging in my android app, in build.gradle.kts.
If i just launch lintFormat the first time, all files will be check. But if i run a second time, only changed files should be checked, right ?
I tried many things, but every files is checked every times. I must be missing something
The lintKotlin task is incremental and only checks files which are changed since last check.
The formatKotlin task however always runs on all files I generally this is ok since it is not part of workflow like check which is invoked often.
Actually, formatKotlin can be a part of a workflow and be invoked often. I have it in the git hooks, running the formatKotlin on each commit locally, which I see takes noticeable time already.
The reason why it's not lintKotlin instead is that we let it commit and immediately show "new changes" for the re-formatted things, making them visible and being automatically fixed when possible. Otherwise with lintKotlin it would require first failing and then running formatKotlin additionally just to get automatic fixes.
If I remember right, the wrinkle here is that formatKotlin modifies the files which are its inputs, so when we tried to make it incremental the behavior wasn't quite what one would expect.
Hi @jeremymailen,
Would it be a problem to use the following code here?
p.files.from(inputChanges.getFileChanges(source))
Just an idea, I didn't have a chance to analyze it more deeply.