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.kts
are:
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.yml
file under the import set of rules.- See detekt.yml for more information.
- ensure your
settings.gradle.kts
file can pull dependencies from maven central.
dependencyResolutionManagement {
repositories {
mavenCentral()
}
}
- in your top level
build.gradle.kts
file you need to let detekt know about the extension.
dependencies {
detektPlugins("com.pkware.detekt:import-extension:x.y")
}
- Where
x.y
corresponds to the version of this detekt-extensions defined in thegradle.properties
file of this project. - in your
detekt.yml
config 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'
- Make and checkout a release branch on github.
- Change the version in gradle.properties to a non-SNAPSHOT version.
- Update the CHANGELOG.md for the impending release.
- Run
git commit -am "Release X.Y.Z."
(where X.Y.Z is the new version) in the terminal or command line. - Make a PR with your changes.
- Merge the release PR after approval, tag the commit on the main branch with
git tag -a X.Y.Z -m "X.Y.Z"
(X.Y.Z is the new version). - Run
git push --tags
. - Run
./gradlew publish
in the terminal or command line. - Visit Sonatype Nexus and promote the artifact.
- Update
gradle.properties
to the next SNAPSHOT version. - Run
git commit -am "Prepare next development version."
- Make a PR with your changes.
- Merge the next version PR after approval.
If step 8 or 9 fails, drop the Sonatype repo, fix the problem, commit, and start again at step 8.