jeremymailen / kotlinter-gradle

Painless, fast ktlint plugin for Gradle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Doesn't work in kts

Goooler opened this issue · comments

You can check out this branch for tests, I added an extra blank but lintKotlin or formatKotlin don't work out of the box, this bug was continued for a long time.

Kotlinter automatically adds lint and format tasks only for supported gradle plugins. In those cases it uses registered source sets.

If a project wanted to lint .kts files which are not part of a known source set, it would need to configure a custom task as described here: https://github.com/jeremymailen/kotlinter-gradle#custom-tasks

Should we add this point in README ?

Seems like it's implied? The documentation leads in describing how tasks are automatically created for supported Gradle plugins. We could have a task on this project that lints it's own build script in the spirit of adopting own capabilities.

As I use ktlint-gradle before kotlinter, it support kts by default, so I assume ktlinter support kts too after migration, but not in actuality.

It supports linting kts files. The main difference in expectation is it will not automatically configure tasks to lint any kts files found in the directory, only those that are in source sets. There's a reasonable case to be made that if a project uses kts build scripts these are well known configured sources it ought to pick up and include in a task such as lintBuildscripts.

I know I know. Just like you said, maybe it's implied, need to add a description?