Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Incremental check may incorrectly run against all source files instead of the correct source set #385

Closed
davidnelson-hms opened this issue Aug 25, 2020 · 0 comments · Fixed by #386
Labels

Comments

@davidnelson-hms
Copy link
Contributor

Versions:
ktlint-gradle: 9.1.1
Gradle version: 6.1.1
Kotlin version: 1.3.61

The Check task filters out incremental changes of type DIRECTORY or REMOVED. If the only changes to a source set as reported by Gradle have those types, then the resulting set of source files after the filter is empty. This causes ktlint to be invoked with an args file that does not list any source files to check. In that case, the default behavior of ktlint is to check ALL source files in the current directory.

I believe the correct behavior in the case where Gradle reports incremental changes, but all such changes are filtered out, would be to set the didWork property to false and return without executing ktlint.

I will try to create a repro and possibly submit a PR when I have time.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
2 participants