You are currently viewing How do you do CI for linting / code inspection for Kotlin code? For example, Intellij IDEA’s “code inspection”?

How do you do CI for linting / code inspection for Kotlin code? For example, Intellij IDEA’s “code inspection”?

I am migrating my java codebase to kotlin, and now I want to have some CI for lining or code inspection. Of course I can click the “run code inspections” in intellij idea and it works fine, but I want to have a command line tool or something that can be run as a routine.

I have tried https://www.jetbrains.com/help/idea/2021.3/command-line-code-inspector.html but it does not work well. What’s worse, it is almost impossible to have intellij installed on a CI machine in the cloud (just think about Github actions, for example).

I also use things like `ktlint` for code formatting, but I have not found a replacement for intellij idea’s “code inspection” because it gives so many useful rules and warnings, such as “!a.isEmpty() should be a.isNotEmpty()” and “a==null is always true because a is not nullable”, etc.

So I wonder how do you do it? Or, you use some other linters, or some other CI, etc?

Thanks for any suggestions!

submitted by /u/fzyzcjy
[link] [comments]