ktlint-ruleset-junit
Custom ktlint ruleset for linting JUnit tests.
Rules
junit-backticked-test-description
- Checks if JUnit test description follows backticks style. For example,
@Test
fun `should add two numbers`() {
assertEquals(3, add(1,2))
}
junit-test-without-assertion
- Checks if JUnit test asserts anything. For example,
@Test
fun `should pass when test body asserts`() {
assertTrue(true)
}
Setup
- Add repository:
repositories {
mavenCentral()
maven {
setUrl("https://dl.bintray.com/arunvelsriram/maven")
}
}
- Add dependency:
dependencies {
ktlint("dev.arunvelsriram.ktlint.rulesets.junit:ktlint-ruleset-junit:1.0.0")
}
Contributing
Development environment
- Install OpenJDK11
- Install IntelliJ IDEA
Run test and build:
./gradlew clean build
bintray
Release to- Add a Git tag for the release
- Update project version in build.gradle.kts and run:
./gradlew bintrayUpload