This project contains extensions for the Detekt linter written in Kotlin. See Extending Detekt for more information.
- EnforceStaticImport-
- This rule extension looks for methods that should be statically imported and issues a code smell if they are found.
- The extension requires that the classpath of Detekt be set properly to provide a binding context for the
methods that should be statically imported.
- See Detekt Type Resolution for details
- Examples of setting the classpath of detekt within
build.gradle.ktsare:
ortasks.withType<Detekt>().configureEach { val paths = mutableListOf( project.configurations.getByName("detekt") ) classpath.setFrom(paths) }
tasks.withType<Detekt>().configureEach { dependsOn("detektMain", "detektTest") }
- Rule configuration can be done in the
detekt.ymlfile under the import set of rules.- See detekt.yml for more information.
- ensure your
settings.gradle.ktsfile can pull dependencies from maven central.
dependencyResolutionManagement {
repositories {
mavenCentral()
}
}- in your top level
build.gradle.ktsfile you need to let detekt know about the extension.
dependencies {
detektPlugins("com.pkware.detekt:import-extension:x.y")
}- Where
x.ycorresponds to the version of this detekt-extensions defined in thegradle.propertiesfile of this project. - in your
detekt.ymlconfig file add the following code to enable the extension:
import:
EnforceStaticImport:
active: true
methods:
- 'com.google.common.truth.Truth.assertThat'
- 'org.junit.jupiter.params.provider.Arguments.arguments'
Releases are automated via release-please. As feat
and fix commits accumulate on main, release-please maintains an open release PR that updates
CHANGELOG.md and bumps the version in gradle.properties. Merging that PR causes release-please to
push a semver tag, which triggers the publish workflow to sign and publish artifacts to Maven Central
and create a GitHub Release with auto-generated release notes.
Every push to main also publishes the current -SNAPSHOT version to the Maven Central snapshot
repository at central.sonatype.com/repository/maven-snapshots/.