A set of linters designed to catch Java API's that may be unfriendly to Kotlin consuming applications.
Currently the only linting is in the form of checkstyle custom checks. Add this library as a dependency to your build and the reference the checks you want to apply in your checkstyle.xml
.
Currently the following checks are available:
- KotlinHardKeywords - checks if any public identifiers (methods or properties) match one of the Kotlin reserved keywords.
- KotlinExtensionMethodShadow - checks that single parameter methods don't shadow Kotlin receiver-based extension methods (e.g.
apply
,run
)
Integrate these checks into your build tool to have them run automatically.
For Gradle builds add the library as a checkstyle dependency as below. Checkout the Gradle Checkstyle plugin documentation for more information on working with Checkstyle in Gradle builds.
apply plugin: 'checkstyle'
dependencies {
...
checkstyle 'com.kiiadi.ktfriendly:checkstyle:${VERSION}'
}
For Maven builds add the library as part of the Maven Checkstyle plugin configuration.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.0.0</version>
<dependencies>
<dependency>
<groupId>com.kiiadi.ktfriendly</groupId>
<artifactId>checkstyle</artifactId>
<version>${VERSION}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>