/ktlint-ruleset-junit

Custom ktlint ruleset for linting JUnit tests.

Primary LanguageKotlin

ktlint-ruleset-junit Build Status

Custom ktlint ruleset for linting JUnit tests.

Link to bintray

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

Run test and build:

./gradlew clean build

Release to bintray

  • Add a Git tag for the release
  • Update project version in build.gradle.kts and run:
./gradlew bintrayUpload