KtLint does not magically update behind the scenes...
# ktlint
p
KtLint does not magically update behind the scenes. If the version and configuration are unchanged since last successful run than the difference must be in the code. I am not familiar enough with the plugin to say something about it.
👍 2
p
Can I somehow get debug info on what ktlint does, to go forward with troubleshooting my problem? E. g. to learn what rules are enabled
p
Yeah, use option “-v” (or “--verbose”).
p
Do you use the cli or some Gradle plugin?
I didn't have time to test the verbose mode yet
So, the log showed not all files being processed. Can it be because one Gradle task creates the files, and
org.gradle.parallel=true
or
org.gradle.caching=true
makes Ktlint not see all files?
These two settings were added 3 days ago, approx. when the issue started to happen, so there's high correlation
@Zongle Wang FYI
Removing these two options solved my issue, but it's still something worth looking at within probably the Gradle plugin. FYI @jlleitschuh
p
And are you sure you correctly declared the outputs and task order?
p
No :) My knowledge about Gradle is limited
p
Can it be because one Gradle task creates the files
It sounds like they are generated at build time?
p
Yes - adding a task dependency so that ktlint runs after the file generation task should do the job right?
p
But why would you ktlint generated Code in the first place?
p
So that it's more readable when someone browses its source
p
Ah wow. Okay that's an interesting requirement
Can you post the skeleton of your Gradle task that generates?
p
Also, we keep these in version control for now, to exactly see what changes over time. Thanks to formatting, diffs are cleaner. One day we may remove it from VCS
p
The correct way would to not use an application plugin but instead a gradle task that declares inputs and outputs.
It might work do declare proper task outputs here, i.e. outputs.dir(project.path
.)
p
Thanks, I'll tinker around it in spare moment. FYI @jmfayard
j
To be honest, I would rather not reformat the generated code with ktlint and configure ktlint/detekt to ignore it.
p
Yes, it's a possible trade-off
p
I would absolutely do that if I maintained that. ^^
p
Thanks for the discussion!