neugartf
02/02/2021, 11:45 PMSha Sha Chu
02/03/2021, 12:03 AMSha Sha Chu
02/03/2021, 12:03 AMneugartf
02/03/2021, 12:17 AMneugartf
02/03/2021, 12:19 AMSha Sha Chu
02/03/2021, 12:21 AMarc
tool has a way to invoke linters. we just use the ktlint
executable jar and run it on the changed files.tapchicoma
02/03/2021, 9:03 AMktlint-gradle
plugin.
It has a task to install pre-commit hook that runs ktlint only on files included into commit. There are two hooks - either just check this files and fail commit or try to format them before committing.
Indeed Gradle configuration phase is not fast, but recently they introduce configuration cache feature (that plugin supports). This feature is greatly increasing speed of this phase.
Additionally I would advice to run ktlint-gradle on your CI pipeline to ensure non-complaint code hasn't been added into codebase.
Generally plugin supports:
• Gradle caching. So, if you have remote build cache, check could be skipped if input sources are not changed and remote cache has entry for current input sources state.
• Incremental check. It could check only changed files.