Skip to content

A set of linting rules that highlight potential problems with a Java library that may make it unfriendly to Kotlin consumers.

License

Notifications You must be signed in to change notification settings

kiiadi/kotlin-friendly-linters

Repository files navigation

Build Codecov Maven Central

Kotlin Friendly Linters

A set of linters designed to catch Java API's that may be unfriendly to Kotlin consuming applications.

Checkstyle

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.

Checks

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)

Build Integration

Integrate these checks into your build tool to have them run automatically.

Gradle

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}'
}

Maven

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>

About

A set of linting rules that highlight potential problems with a Java library that may make it unfriendly to Kotlin consumers.

Resources

License

Stars

Watchers

Forks

Packages

No packages published