Detekt - Static code analysis for Kotlin

Overview

detekt

Join the chat at #detekt on KotlinLang Visit the website at detekt.github.io/detekt/ Maven Central Gradle Plugin

Pre Merge Checks Codecov Awesome Kotlin Badge FOSSA Status

Meet detekt, a static code analysis tool for the Kotlin programming language. It operates on the abstract syntax tree provided by the Kotlin compiler.

detekt in action

Features

  • Code smell analysis for your Kotlin projects
  • Complexity reports based on lines of code, cyclomatic complexity and amount of code smells
  • Highly configurable rule sets
  • Suppression of findings with Kotlin's @Suppress and Java's @SuppressWarnings annotations
  • Specification of quality gates which will break your build
  • Code Smell baseline and suppression for legacy projects
  • Gradle plugin for code analysis via Gradle builds
  • SonarQube integration
  • Extensibility by enabling incorporation of personal rule sets, FileProcessListener's and OutputReport's
  • IntelliJ integration
  • Third party integrations for Maven, Bazel and Github Actions (Docker based and Javascript based)

Project Website

Visit the project website for installation guides, release notes, migration guides, rule descriptions and configuration options.

Quick-Links

Quick Start ...

with the command-line interface

curl -sSLO https://github.com/detekt/detekt/releases/download/v[version]/detekt-cli-[version]-all.jar
java -jar detekt-cli-[version]-all.jar --help

You can find other ways to install detekt here

with Gradle

().configureEach { reports { html.required.set(true) // observe findings in your browser with structure and code snippets xml.required.set(true) // checkstyle like format mainly for integrations like Jenkins txt.required.set(true) // similar to the console output, contains issue signature to manually edit baseline files sarif.required.set(true) // standardized SARIF format (https://sarifweb.azurewebsites.net/) to support integrations with Github Code Scanning } } // Groovy DSL tasks.withType(Detekt).configureEach { jvmTarget = "1.8" } tasks.withType(DetektCreateBaselineTask).configureEach { jvmTarget = "1.8" } // or // Kotlin DSL tasks.withType ().configureEach { jvmTarget = "1.8" } tasks.withType ().configureEach { jvmTarget = "1.8" }">
plugins {
    id("io.gitlab.arturbosch.detekt").version("[version]")
}

repositories {
    mavenCentral()
}

detekt {
    buildUponDefaultConfig = true // preconfigure defaults
    allRules = false // activate all available (even unstable) rules.
    config = files("$projectDir/config/detekt.yml") // point to your custom config defining rules to run, overwriting default behavior
    baseline = file("$projectDir/config/baseline.xml") // a way of suppressing issues before introducing detekt
}

tasks.withType<Detekt>().configureEach {
    reports {
        html.required.set(true) // observe findings in your browser with structure and code snippets
        xml.required.set(true) // checkstyle like format mainly for integrations like Jenkins
        txt.required.set(true) // similar to the console output, contains issue signature to manually edit baseline files
        sarif.required.set(true) // standardized SARIF format (https://sarifweb.azurewebsites.net/) to support integrations with Github Code Scanning
    }
}

// Groovy DSL
tasks.withType(Detekt).configureEach {
    jvmTarget = "1.8"
}
tasks.withType(DetektCreateBaselineTask).configureEach {
    jvmTarget = "1.8"
}

// or

// Kotlin DSL
tasks.withType<Detekt>().configureEach {
    jvmTarget = "1.8"
}
tasks.withType<DetektCreateBaselineTask>().configureEach {
    jvmTarget = "1.8"
}

See maven central for releases and sonatype for snapshots.

If you want to use a SNAPSHOT version, you can find more info on this documentation page.

Requirements

Gradle 6.1+ is the minimum requirement. However, the recommended versions together with the other tools recommended versions are:

Detekt Version Gradle Kotlin AGP Java Target Level JDK Max Version
1.19.0 7.3.0 1.5.31 4.2.2 1.8 17

The list of recommended versions for previous detekt version is listed here.

Adding more rule sets

detekt itself provides a wrapper over ktlint as a formatting rule set which can be easily added to the Gradle configuration:

dependencies {
    detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:[version]")
}

Likewise custom extensions can be added to detekt.

Contributing

See CONTRIBUTING

Thanks to all the people who contributed to detekt!

Mentions

androidweekly androidweekly

As mentioned in...

Integrations:

Custom rules and reports from 3rd parties:

Credits

Comments
  • SARIF export support

    SARIF export support

    opened by dector 53
  • Add support for consolidated report in multi-project setup

    Add support for consolidated report in multi-project setup

    Based on the recent change highlighted in the change log, I have setup a multi-project by adding detekt to the subprojects like:

    subprojects {
        detekt {
            // properties
        }
     }
    

    The reports are generated successfully in the sub-projects. What should I do to get a consolidated report of all sub-projects? The earlier suggestions seem to be for the older profile based config and does not seem to work with this change.

    feature 
    opened by vasanthdharmaraj 40
  • JVM 17 & Kotlin 1.6.x Support

    JVM 17 & Kotlin 1.6.x Support

    The changes made to the final version of 1.20.0 have reverted fixes that addressed the invalid jvm target error experienced in this ticket. https://github.com/detekt/detekt/issues/4287

    * What went wrong:
    Execution failed for task ':match-api:detekt'.
    > Invalid value passed to --jvm-target
    

    I'm currently unable to upgrade to resolve the current XML External Entity (XXE) Injection vulnerability. Version 1.20.0-RC2 continues to have no issues with JVM 17 and Kotlin 1.6.x, but does not have a resolution for the vulnerability.

    bug 
    opened by Nitewriter 38
  • Add automatic detekt tasks for Android Plugins

    Add automatic detekt tasks for Android Plugins

    The Gradle Plugin was missing automatic task generation for Android modules, so I tried adding them.

    While this works in general, I still get a couple of compilation issues when running the task on different modules, mainly things that stem from code generation:

    /DownloadApiFactory.kt:7:24: error: unresolved reference: BuildConfig
    import my.module.BuildConfig
                           ^
    /DownloadApiFactory.kt:28:52: error: unresolved reference: BuildConfig
            .client(downloadOkHttpFactory.createClient(BuildConfig.DEBUG, readTimeOutSeconds))
    
    opened by realdadfish 35
  • Get detekt a logo

    Get detekt a logo

    Detekt is close to reach 3K stars (🎉 we should celebrate) and I have the feeling is really time to find a proper logo for this project.

    I already found a couple of scenarios where having a logo would be helpful:

    • Third party tools that integrate Detekt inspections (e.g. Codacy).
    • Github Actions or Apps that integrate detekt (e.g. https://github.com/Mkohm/detekt-hint)
    • General material coming from the community (e.g. detekt is one of the few tools without a logo in this ecosystem spreadsheet)

    It think it would be great if this comes as a community contribution. Maybe someone with graphics skills can draft some proposals.

    improvement documentation 
    opened by cortinico 31
  • Add config generator for custom rules

    Add config generator for custom rules

    Work in progress For #4457

    This is just a draft to understand if I'm doing it the right way. Please, share your thoughts.

    Created gradle task generateCustomConfig by copying generateDocumentation which accepts source path for rules and creates config.yml in the path indicated in config parameter.

    notable changes 
    opened by VitalyVPinchuk 29
  • Non-deterministic exceptions in parallel builds when switching from 1.16.0-RC3 to 1.16.0

    Non-deterministic exceptions in parallel builds when switching from 1.16.0-RC3 to 1.16.0

    Expected Behavior

    ./gradlew detekt should not crash in version 1.16.0 for a project using Kotlin 1.4.31.

    Observed Behavior

    ./gradlew detekt crashes in version 1.16.0, which rather non-deterministic exceptions. At first I thought I would be affected by https://github.com/detekt/detekt/issues/3248 as the exception messages are sometimes similar, but I cannot see any relation to parallel builds (as disabling parallel builds doe not help).

    Note that detekt version 1.16.0-RC3 actually works!

    Steps to Reproduce

    1. Clone https://github.com/sschuberth/stan
    2. Checkout the detekt-1.16.0 branch
    3. Run ./gradlew detekt --no-build-cache --rerun-tasks
    4. Observe:
    sebastian@passau MINGW64 ~/Development/GitHub/sschuberth/stan (detekt-1.16.0)
    $ ./gradlew detekt --no-build-cache --rerun-tasks
    
    > Configure project :gui
    Project :gui => no module-info.java found
    
    > Task :lib:detekt FAILED
    > Task :gui:detekt FAILED
    > Task :detekt FAILED
    
    FAILURE: Build completed with 3 failures.
    
    1: Task failed with an exception.
    -----------
    * What went wrong:
    Execution failed for task ':lib:detekt'.
    > Collection is empty.
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    ==============================================================================
    
    2: Task failed with an exception.
    -----------
    * What went wrong:
    Execution failed for task ':gui:detekt'.
    > kotlin/KotlinNullPointerException
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    ==============================================================================
    
    3: Task failed with an exception.
    -----------
    * What went wrong:
    Execution failed for task ':detekt'.
    > io/github/detekt/tooling/api/InvalidConfig
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    ==============================================================================
    
    * Get more help at https://help.gradle.org
    
    Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
    Use '--warning-mode all' to show the individual deprecation warnings.
    See https://docs.gradle.org/6.8.3/userguide/command_line_interface.html#sec:command_line_warnings
    
    BUILD FAILED in 5s
    4 actionable tasks: 4 executed
    

    Now do the same on the detekt-1.16.0-RC3 branch and observe:

    sebastian@passau MINGW64 ~/Development/GitHub/sschuberth/stan (detekt-1.16.0-RC3)
    $ ./gradlew detekt --no-build-cache --rerun-tasks
    
    > Configure project :gui
    Project :gui => no module-info.java found
    
    Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
    Use '--warning-mode all' to show the individual deprecation warnings.
    See https://docs.gradle.org/6.8.3/userguide/command_line_interface.html#sec:command_line_warnings
    
    BUILD SUCCESSFUL in 7s
    4 actionable tasks: 4 executed
    

    Context

    I'm trying to upgrade from detekt 1.15.0 / 1.16.0-RC3 to version 1.16.0 final.

    Your Environment

    • Version of detekt used: 1.15.0 / 1.16.0-RC3 and 1.16.0
    • Version of Gradle used (if applicable): 6.8.3
    • Gradle scan link (add --scan option when running the gradle task): n/a
    • Operating System and version: Windows 10 64-bit
    • Link to your project (if it's a public repository): https://github.com/sschuberth/stan
    bug 
    opened by sschuberth 29
  • Detekt parallel crash

    Detekt parallel crash

    Observed Behavior

    Detekt crashes when executed in a project with multiple modules and enabled org.gradle.parallel with java.lang.ClassNotFoundException: kotlin.ExceptionsKt

    The problem is reproducible with 100 percent probability. I found similar closed issue #2629

    Detekt configuration
    plugins {
      id("io.gitlab.arturbosch.detekt").version("1.15.0-RC1")
    }
    
    subprojects {
    
      apply { plugin("io.gitlab.arturbosch.detekt") }
      detekt {
          failFast = true
          buildUponDefaultConfig = true
          baseline = file("${rootProject.projectDir}/static_analysis/config/detekt/baseline.xml")
          config = files("${rootProject.projectDir}/static_analysis/config/detekt/config.yml")
          autoCorrect = true
          ignoreFailures = false
          parallel = true
    
          reports {
              html.enabled = true
              xml.enabled = true
              txt.enabled = true
          }
      }
    
      tasks {
          withType<io.gitlab.arturbosch.detekt.Detekt> {
              this.jvmTarget = "1.8"
              description = "Overrides current baseline."
    
              setSource(files(rootDir))
              include("**/*.kt")
              include("**/*.kts")
              exclude("**/resources/**")
              exclude("**/build/**")
          }
      }
    }
    
    Full stack trace

    [2020-11-25 12:43:19.016616] FAILURE: Build failed with an exception. [2020-11-25 12:43:19.016624] [2020-11-25 12:43:19.016630] * What went wrong: [2020-11-25 12:43:19.016635] Execution failed for task ':core:detekt'. [2020-11-25 12:43:19.016640] > kotlin/ExceptionsKt [2020-11-25 12:43:19.016645] [2020-11-25 12:43:19.016650] * Try: [2020-11-25 12:43:19.016655] Run with --info or --debug option to get more log output. Run with --scan to get full insights. [2020-11-25 12:43:19.016660] [2020-11-25 12:43:19.016665] * Exception is: [2020-11-25 12:43:19.016670] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':core:detekt'. [2020-11-25 12:43:19.016675] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:208) [2020-11-25 12:43:19.016680] at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:263) [2020-11-25 12:43:19.016684] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:206) [2020-11-25 12:43:19.016689] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:187) [2020-11-25 12:43:19.016694] at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:114) [2020-11-25 12:43:19.016699] at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46) [2020-11-25 12:43:19.016704] at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:62) [2020-11-25 12:43:19.016708] at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57) [2020-11-25 12:43:19.016713] at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56) [2020-11-25 12:43:19.016718] at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36) [2020-11-25 12:43:19.016723] at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77) [2020-11-25 12:43:19.016728] at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55) [2020-11-25 12:43:19.016732] at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52) [2020-11-25 12:43:19.016737] at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:409) [2020-11-25 12:43:19.016761] at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:399) [2020-11-25 12:43:19.016767] at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:157) [2020-11-25 12:43:19.016772] at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:242) [2020-11-25 12:43:19.016776] at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:150) [2020-11-25 12:43:19.016781] at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:94) [2020-11-25 12:43:19.016786] at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36) [2020-11-25 12:43:19.016791] at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52) [2020-11-25 12:43:19.016796] at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:41) [2020-11-25 12:43:19.016801] at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:372) [2020-11-25 12:43:19.016805] at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:359) [2020-11-25 12:43:19.016810] at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:352) [2020-11-25 12:43:19.016815] at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:338) [2020-11-25 12:43:19.016820] at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127) [2020-11-25 12:43:19.016825] at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191) [2020-11-25 12:43:19.016829] at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182) [2020-11-25 12:43:19.016834] at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124) [2020-11-25 12:43:19.016839] at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64) [2020-11-25 12:43:19.016843] at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48) [2020-11-25 12:43:19.016848] at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56) [2020-11-25 12:43:19.016853] Caused by: org.gradle.api.GradleException: kotlin/ExceptionsKt [2020-11-25 12:43:19.016858] at io.gitlab.arturbosch.detekt.invoke.DefaultCliInvoker.invokeCli(DetektInvoker.kt:63) [2020-11-25 12:43:19.016863] at io.gitlab.arturbosch.detekt.Detekt.check(Detekt.kt:208) [2020-11-25 12:43:19.016867] at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104) [2020-11-25 12:43:19.016872] at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:58) [2020-11-25 12:43:19.016877] at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:51) [2020-11-25 12:43:19.016882] at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:29) [2020-11-25 12:43:19.016887] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.run(ExecuteActionsTaskExecuter.java:570) [2020-11-25 12:43:19.016892] at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:395) [2020-11-25 12:43:19.016896] at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:387) [2020-11-25 12:43:19.016906] at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:157) [2020-11-25 12:43:19.016912] at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:242) [2020-11-25 12:43:19.016916] at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:150) [2020-11-25 12:43:19.016921] at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:84) [2020-11-25 12:43:19.016926] at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31) [2020-11-25 12:43:19.016930] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:555) [2020-11-25 12:43:19.016935] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:538) [2020-11-25 12:43:19.016940] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$300(ExecuteActionsTaskExecuter.java:109) [2020-11-25 12:43:19.016945] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.executeWithPreviousOutputFiles(ExecuteActionsTaskExecuter.java:279) [2020-11-25 12:43:19.016950] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:268) [2020-11-25 12:43:19.016955] at org.gradle.internal.execution.steps.ExecuteStep.lambda$execute$1(ExecuteStep.java:33) [2020-11-25 12:43:19.016959] at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:33) [2020-11-25 12:43:19.016964] at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:26) [2020-11-25 12:43:19.016969] at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:67) [2020-11-25 12:43:19.016973] at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:36) [2020-11-25 12:43:19.016978] at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:49) [2020-11-25 12:43:19.016983] at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:34) [2020-11-25 12:43:19.016988] at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:43) [2020-11-25 12:43:19.016992] at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:73) [2020-11-25 12:43:19.016997] at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:54) [2020-11-25 12:43:19.017002] at org.gradle.internal.execution.steps.CatchExceptionStep.execute(CatchExceptionStep.java:34) [2020-11-25 12:43:19.017007] at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:44) [2020-11-25 12:43:19.017011] at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:54) [2020-11-25 12:43:19.017016] at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:38) [2020-11-25 12:43:19.017021] at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:49) [2020-11-25 12:43:19.017026] at org.gradle.internal.execution.steps.CacheStep.executeWithoutCache(CacheStep.java:159) [2020-11-25 12:43:19.017030] at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:72) [2020-11-25 12:43:19.017037] at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:43) [2020-11-25 12:43:19.017171] at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:44) [2020-11-25 12:43:19.017181] at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:33) [2020-11-25 12:43:19.017192] at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:38) [2020-11-25 12:43:19.017197] at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:24) [2020-11-25 12:43:19.017202] at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:92) [2020-11-25 12:43:19.017207] at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:85) [2020-11-25 12:43:19.017212] at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:55) [2020-11-25 12:43:19.017217] at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:39) [2020-11-25 12:43:19.017222] at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:76) [2020-11-25 12:43:19.017227] at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:37) [2020-11-25 12:43:19.017231] at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:36) [2020-11-25 12:43:19.017236] at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:26) [2020-11-25 12:43:19.017241] at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:94) [2020-11-25 12:43:19.017246] at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:49) [2020-11-25 12:43:19.017251] at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:79) [2020-11-25 12:43:19.017256] at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:53) [2020-11-25 12:43:19.017261] at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:74) [2020-11-25 12:43:19.017265] at org.gradle.internal.execution.steps.SkipEmptyWorkStep.lambda$execute$2(SkipEmptyWorkStep.java:78) [2020-11-25 12:43:19.017270] at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:78) [2020-11-25 12:43:19.017275] at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:34) [2020-11-25 12:43:19.017280] at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:39) [2020-11-25 12:43:19.017285] at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:40) [2020-11-25 12:43:19.017289] at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:28) [2020-11-25 12:43:19.017294] at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:33) [2020-11-25 12:43:19.017299] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:195) [2020-11-25 12:43:19.017304] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:187) [2020-11-25 12:43:19.017309] at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:114) [2020-11-25 12:43:19.017313] at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46) [2020-11-25 12:43:19.017318] at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:62) [2020-11-25 12:43:19.017323] at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57) [2020-11-25 12:43:19.017328] at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56) [2020-11-25 12:43:19.017332] at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36) [2020-11-25 12:43:19.017342] at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77) [2020-11-25 12:43:19.017347] at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55) [2020-11-25 12:43:19.017352] at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52) [2020-11-25 12:43:19.017356] at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:409) [2020-11-25 12:43:19.017361] at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:399) [2020-11-25 12:43:19.017366] at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:157) [2020-11-25 12:43:19.017371] at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:242) [2020-11-25 12:43:19.017376] at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:150) [2020-11-25 12:43:19.017380] at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:94) [2020-11-25 12:43:19.017385] at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36) [2020-11-25 12:43:19.017390] at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52) [2020-11-25 12:43:19.017395] at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:41) [2020-11-25 12:43:19.017399] at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:372) [2020-11-25 12:43:19.017404] at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:359) [2020-11-25 12:43:19.017409] at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:352) [2020-11-25 12:43:19.017414] at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:338) [2020-11-25 12:43:19.017418] at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127) [2020-11-25 12:43:19.017423] at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191) [2020-11-25 12:43:19.017428] at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182) [2020-11-25 12:43:19.017433] at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124) [2020-11-25 12:43:19.017437] at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64) [2020-11-25 12:43:19.017442] at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48) [2020-11-25 12:43:19.017447] at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56) [2020-11-25 12:43:19.017452] Caused by: java.lang.NoClassDefFoundError: kotlin/ExceptionsKt [2020-11-25 12:43:19.017457] at kotlin.io.CloseableKt.closeFinally(Closeable.kt:62) [2020-11-25 12:43:19.017461] at io.gitlab.arturbosch.detekt.core.tooling.ProcessingSpecSettingsBridgeKt.withSettings(ProcessingSpecSettingsBridge.kt:24) [2020-11-25 12:43:19.017466] at io.gitlab.arturbosch.detekt.core.tooling.AnalysisFacade.runAnalysis$detekt_core(AnalysisFacade.kt:42) [2020-11-25 12:43:19.017471] at io.gitlab.arturbosch.detekt.core.tooling.AnalysisFacade.run(AnalysisFacade.kt:25) [2020-11-25 12:43:19.017476] at io.gitlab.arturbosch.detekt.cli.runners.Runner.call(Runner.kt:33) [2020-11-25 12:43:19.017485] at io.gitlab.arturbosch.detekt.cli.runners.Runner.execute(Runner.kt:23) [2020-11-25 12:43:19.017490] at io.gitlab.arturbosch.detekt.invoke.DefaultCliInvoker.invokeCli(DetektInvoker.kt:56) [2020-11-25 12:43:19.017495] ... 91 more [2020-11-25 12:43:19.017499] Caused by: java.lang.ClassNotFoundException: kotlin.ExceptionsKt [2020-11-25 12:43:19.017504] ... 98 more

    Environment

    • Version of detekt used: 1.15.0-RC1 or 1.14.0
    • Version of Gradle used: 6.6.1 or 6.4.1
    • Version of Kotlin 1.4.10
    bug 
    opened by VladislavSumin 29
  • Implement base Gradle StaticAnalysis classes for Gradle Plugin

    Implement base Gradle StaticAnalysis classes for Gradle Plugin

    This is still WIP but publishing for feedback.

    As described in Issues #580 and #540 this PR makes the Detekt Gradle Plugin implement the base StaticAnalysis classes SourceTask and AbstractCodeQualityPlugin

    This work will result in breaking API changes of the Detekt Gradle Plugins API as the Plugin will now behave more like the PMD, Checkstyle, Findbugs and similar static analysis plugins.

    This work will also result in detekt running as part of ./gradlew check and therefore ./gradlew build if the plugin is added to the project.

    I had to make minor changes to account for the new way to have inputs based on source sets and not explicitly giving an input path in the API. With these changes the Gradle Plugin will automatically generate tasks for running detekt for each sourceSet: detektMain, detektTest, etc. Those sourceSets will be the inputs for the detekt CLI.

    Due to the change how output reports are defined in the same manner as other tools like PMD and Checkstyle do in their Gradle API there are some more changes needed to detekt-cli and detekt-core to account for enabling disabling certain reports and changing their output paths with the CLI arguments.

    The changes to the API are visible in the top-level build.gradle file in this PR. Essentially I believe this will make the concept of profiles go away as it is really easy to define a second detekt task with some special parameters (see the detektFailfast task in the build.gradle file).

    Missing:

    • [x] Update documentation when implementation is finished
    • [x] ~~Decide on profile handling.~~ Removed
    • [x] Implement detektCreateBaseline and detektGenerateConfig tasks.
    • [x] Implement idea tasks.
    • [x] Create detektCheck task which delegates to the main detekt task to provide backwards compatibility
    gradle-plugin 
    opened by Mauin 29
  • Rename Blacklist and Whitelist to be self explanatory

    Rename Blacklist and Whitelist to be self explanatory

    I originally started this exercise because I believe the terms blacklist and whitelist have racial connotations that are inappropriate to be used. But while trying to find new names I found that SuppressedFalsePositive and TemporarySuppressedIssues actually describe much more accurately than the previous values.

    This PR would currently be a breaking change because existing baseline files would no longer work. If desired I think it would be possible to build in backward compatibility. However, I think the fact that this is a breaking change is a good thing because it will raise more awareness about the fact that blacklist and whitelist are really terms that we should all stop using.

    Edit: Updated the PR to not be a breaking change anymore. Existing baseline files with <Blacklst> and <Whitelist> tags will still be supported, but newly generated baselines will use SuppressedFalsePositive and TemporarySuppressedIssues respectively.

    migration 
    opened by remcomokveld 27
  • Publish straight to JCenter

    Publish straight to JCenter

    Please publish the artifacts straight to JCenter instead of "misusing" Bintray as a Maven repository. That would simplify the setup for most users as JCenter usually is already added as a repository.

    build documentation 
    opened by sschuberth 26
  • Re-enable test task in detekt-compiler-plugin

    Re-enable test task in detekt-compiler-plugin

    Expected Behavior

    Tests are run in detekt-compiler-plugin project.

    Current Behavior

    Tests won't run on Kotlin 1.8 until https://github.com/tschuchortdev/kotlin-compile-testing/issues/336 is fixed.

    Context

    Tests were disabled to unblock #5614

    blocked housekeeping 
    opened by 3flex 0
  • Report or fail build when `kotlin-compiler-embeddable` version is overridden

    Report or fail build when `kotlin-compiler-embeddable` version is overridden

    Expected Behavior

    detekt runs successfully using the expected version of the kotlin-compiler-embeddable dependency. If the version of the dependency is overridden in the user's build, either warn the user or fail the build, with a link to documentation explaining the issue and some ways to deal with it.

    Current Behavior

    This keeps coming up as an issue that detekt doesn't properly handle.

    Context

    #5644 #5582 #5551 #5021 #4786 #4287

    improvement 
    opened by 3flex 1
  • Check for illegal usage of functions annotated with @TestOnly or @VisibleForTesting

    Check for illegal usage of functions annotated with @TestOnly or @VisibleForTesting

    Expected Behavior of the rule

    Functions annotated with @TestOnly (JetBrains) or @VisibleForTesting (Guava) should not be used in production code, but only in test code.

    Context

    I think it's the same as: https://rules.sonarsource.com/java/RSPEC-5803?search=junit

    rules 
    opened by mrclrchtr 5
  • False positive on `ExplicitCollectionElementAccessMethod` with spread operator

    False positive on `ExplicitCollectionElementAccessMethod` with spread operator

    Expected Behavior

    I have this interface:

    interface Foo {
        operator fun get(key: String, vararg objects: Any): String
    }
    

    And when I call it like this foo.get(key, *objects) I expect that ExplicitCollectionElementAccessMethod will not flag it. foo[key, *objects] is not valid kotlin code so the only way to call it is foo.get(key, *objects)

    Observed Behavior

    foo.get(key, *objects) is flagged

    Your Environment

    • Version of detekt used: 1.22.0
    help wanted rules false-positive good first issue 
    opened by BraisGabin 2
  • Add the ability to specify a detekt config from a remote artifact

    Add the ability to specify a detekt config from a remote artifact

    Expected Behavior

    I'd like to be able to specify a detekt config from a remote artifact (e.g. maven).

    Current Behavior

    A detekt config has to be specified from a local file. It is possible to use a remote artifact in some scenarios, but it neither simple nor straightforward.

    Context

    I manage 30+ projects that use detekt. Whenever there's a detekt update (new rules, updated config, config deprecations, etc...) I have to update the config in all of those projects. It's a very manual, labor intensive task.

    If I was able to have a single detekt config file that I publish to a maven repo, it would greatly simplify the process. There would be a one time cost of specifying the maven coordinates for the artifact, and that would be it. Leveraging Maven's versioning makes it even simpler, as I could update the config for a specific repo when I'm ready to. Tools like renovate and dependabot work very well with this since they'll create a PR automatically when I publish an update to the remote config.

    If a project needed to change the config, it could simply provide a local config file to overlay the remote one.

    feature 
    opened by eygraber 15
Releases(v1.22.0)
  • v1.22.0(Nov 21, 2022)

    We're extremely excited to announce the next upcoming stable release of Detekt: 1.22.0 🚀 This release is coming with 16 new rules, 2 new rulesets and several new functionalities & APIs.

    We've also introduced the Detekt Marketplace, a place for users to share their 3rd party rules and extensions.

    We want to take the opportunity to thank our Sponsors and our Contributors for testing, bug reporting and helping us release this new version of Detekt. You're more than welcome to join our community on the #detekt channel on KotlinLang's Slack (you can get an invite here).

    Notable Changes
    • We're introducing the Detekt Marketplace, a place where you can add your own 3rd party extension such as rule, plugins, custom reporter, etc. - #5191
    • Our website is now versioned. You can find the changes for each version using the dropdown menu on the top bar. Documentation for the upcoming version (next) can be found here.
    • We added 16 new Rules to Detekt
      • AlsoCouldBeApply - #5333
      • MultilineRawStringIndentation - #5058
      • TrimMultilineRawString - #5051
      • UnnecessaryNotNullCheck - #5218
      • UnnecessaryPartOfBinaryExpression - #5203
      • UseSumOfInsteadOfFlatMapSize - #5405
      • FunctionReturnTypeSpacing from KtLint - #5256
      • FunctionSignature from KtLint - #5256
      • FunctionStartOfBodySpacing from KtLint - #5256
      • NullableTypeSpacing from KtLint - #5256
      • ParameterListSpacing from KtLint - #5256
      • SpacingBetweenFunctionNameAndOpeningParenthesis from KtLint - #5256
      • TrailingCommaOnCallSite from KtLint - #5312
      • TrailingCommaOnDeclarationSite from KtLint - #5312
      • TypeParameterListSpacing from KtLint - #5256
    • We added a new ruleset called detekt-rules-ruleauthors containing rules for Rule Authors to enforce best practices on Detekt rules such as the new ViolatesTypeResolutionRequirements - #5129 #5182
    • We added a new ruleset called detekt-rules-libraries containing rules mostly useful for Library Authors - We moved the following rules inside ForbiddenPublicDataClass, LibraryCodeMustSpecifyReturnType, LibraryEntitiesShouldNotBePublic this new ruleset - See Migration below on how to migrate #5360
    • We added support for JVM toolchain. This means that Detekt will now respect the JDK toolchain you specify on your Gradle configuration. You will also be able to specify a custom JDK home with the --jdk-home CLI parameter - #5269
    • Improvement for Type Resolution
      • We will now skip rules annotated with @RequiresTypeResolution when without Type Resolution - #5176
      • We will warn users if they run rules requiring Type Resolution when Type Resolution is disabled, so they're not silently skipped - #5226
    • Improvement for Config Management
      • We added exhaustiveness check during config validation. You can enable it checkExhaustiveness: true in your config file. This is disabled by default. - #5089
      • We added support for generating custom configuration for rule authors - #5080
    • Deprecations & Removals
      • We deprecated the MultiRule class as it was overly complicated. The suggested approach is to just provide separated rules. - #5161
      • The --fail-fast CLI flag (and failFast Gradle property) has been removed. It was deprecated since 1.16.x - #5290
      • We deprecated the following rules DuplicateCaseInWhenExpression, MissingWhenCase, RedundantElseInWhen as the Kotlin Compiler is already reporting errors for those scenarios - #5309
      • We removed the --print-ast CLI flag as PsiViewer provides the same features - #5418
    • Notable changes to existing rules
      • ArrayPrimitive is now working only with Type Resolution - #5175
      • WildcardImport is now running also on tests by default - #5121
      • ForbiddenImport allows now to specify a reason for every forbidden import - #4909
      • IgnoredReturnValue: option restrictToAnnotatedMethods is now deprecated in favor of restrictToConfig - #4922
    • This version of Detekt is built with Gradle v7.5.1, AGP 7.3.1, Kotlin 1.7.21 and KtLint 0.47.1 (see #5363 #5189 #5411 #5312 #5519)
    • The minimum supported Gradle version is now v6.7.1 - #4964
    Migration

    We deprecated a number of rules in this release.

    You should update your config file as follows:

      potential-bugs:
        active: true
        ...
    -   DuplicateCaseInWhenExpression:
    -     active: true
        ...
    -   MissingWhenCase:
    -     active: true
    -     allowElseExpression: true
        ...
    -   RedundantElseInWhen:
    -     active: true
    
      style:
        active: true
        ...
    -   ForbiddenPublicDataClass:
    -     active: true
    -     excludes: ['**']
    -     ignorePackages:
    -       - '*.internal'
    -       - '*.internal.*'
        ...
    -   LibraryCodeMustSpecifyReturnType:
    -     active: true
    -     excludes: ['**']
        ...
    -   LibraryEntitiesShouldNotBePublic:
    -     active: true
    -     excludes: ['**']
    

    If you wish to use the libraries ruleset we introduced you should add the following to your config file:

    + libraries:
    +   active: true
    +   ForbiddenPublicDataClass:
    +     active: false
    +   LibraryEntitiesShouldNotBePublic:
    +     active: false
    +   LibraryCodeMustSpecifyReturnType:
    +     active: true
    

    and add the following to you build.gradle file:

    detektPlugins("io.gitlab.arturbosch.detekt:detekt-rules-libraries:$version")
    

    If you're using our KtLint wrapper (i.e. detekt-formatting) you should also update your config file as follows:

    formatting:
      active: true
      ...
    - TrailingComma:
    -   active: false
    -   autoCorrect: true
    -   allowTrailingComma: false
    -   allowTrailingCommaOnCallSite: false
      ...
    + TrailingCommaOnCallSite:
    +   active: false
    +   autoCorrect: true
    +   useTrailingCommaOnCallSite: false
    + TrailingCommaOnDeclarationSite:
    +   active: false
    +   autoCorrect: true
    +   useTrailingCommaOnDeclarationSite: false
    
    Changelog
    • ReturnCount: correctly count assignment expressions with elvis return as guard clauses - #5539
    • UnnecessaryPartOfBinaryExpression: fix false positive with pair creation - #5516
    • False positive at UnnecessaryPartOfBinaryExpression - #5514
    • Update documentation for TrailingComma rules - #5513
    • TrimMultilineRawString false-positive on annotation parameters - #5476
    • Detekt 1.22.0-RC1 -> 1.22.0-RC2 breaks UnreachableCode - #5435
    • Detekt 1.22.0-RC1 -> 1.22.0-RC2 breaks ignoreAnnotated - #5427
    • Fix issues introduced by #5152 - #5508
    • MultilineLambdaItParameter: fix false positive for one-line statements with a lambda argument - #5505
    • UseArrayLiteralsInAnnotations: fix false negative with primitive array factory calls - #5482
    • TrimMultilineRawString: fix false positive when it's expected as constant - #5480
    • Fix false negative SafeCast with no braces - #5479
    • Update gradle/wrapper-validation-action digest to 55e685c - #5472
    • Grant permission for type resolution Gradle job - #5470
    • Fix ObjectPropertyNaming Rule false positive - #5466
    • Fix LambdaParameterNaming rule false positive - #5465
    • Fix ReturnCount false positive when excludeReturnFromLambda is enabled - #5459
    • CognitiveComplexity: count else/else-if as one complexity - #5458
    • Fix false positive MultilineRawStringIndentation with tab indentation - #5453
    • Don't show the number of issues generating the BindingContext - #5449
    • Make detekt less noisy - #5448
    • New ruleauthors rule for Entity.from(x.nameIdentifier ?: x) -> Entity.atName(x) - #5444
    • Separating ComplexMethod rule into CyclomaticComplexMethod and CognitiveComplexMethod - #5442
    • Improve error reporting for CascadingCallWrapping - #5439
    • TrimMultilineRawString: fix false positive with not a raw string - #5438
    • BooleanPropertyNaming highlight only the name of the variable - #5431
    • Deprecate TrailingComma as it's now split in two rules - #5423
    • Remove unused constant - #5421
    • Report if/else as issue location instead of block - #5407
    • Remove some unnecessary suppressions - #5400
    • Check FormattingRule is auto-correctable by information provided by ktlint - #5398
    • Fix false negative MultilineLambdaItParameter on complex multiline single statement - #5397
    • ObjectPropertyNaming: fix false positive with top level properties - #5390
    • Remove usage of MPP targets function for JVM-only projects - #5383
    • UnnecessaryNotNullCheck: fix false negative with smart casted arguments - #5380
    • Add missing overlapping info & fix rules URLs - #5378
    • AlsoCouldBeApply: fix false positive when all statements are not it-started expressions - #5376
    • UnusedPrivateMember: fix false negative with named arguments - #5374
    • Change requires type resolution rule warning to debug level to not spam the user console - #5353
    • Report UseDataClass findings on class name - #5352
    • Report LabeledExpression as the label instead of the whole expression - #5351
    • Report CastToNullableType at the cast operator instead of the whole expression - #5350
    • Convert previously known string property to list based on default value - #5347
    • CastToNullableType: highlights too much - #5346
    • UseDataClass flags the whole class body, not just the name - #5338
    • CanBeNonNullable: explain why the rule does what it does. - #5332
    • Differentiate between correctable and non-correctable KtLint rules - #5324
    • ReturnCount 1.22.0 crashes on valid 1.21.0 config property excludedFunctions when using --all-rules cli flag - #5323
    • LabeledExpression to highlight only label - #5316
    • Use the correct source directory set on JVM - #5163
    • Get Android variant compile classpath from compileConfiguration - #5152
    • Use list config for FunctionOnlyReturningConstant>excludedFunctions - #5120
    • MaxLineLength: raw typo and test cleanup - #5315
    • EndOfSentenceFormat: fix HTML tag heuristic - #5313
    • Fix EndOfSentenceFormat highlight - #5311
    • Introduce configFile property on DetektGenerateTask - #5308
    • Improve debug suggestion message - #5300
    • Fat-Jar version of detekt-generator module - #5297
    • Toolchains docs - #5293
    • Adopt new AGP dsl - #5288
    • NonBooleanPropertyPrefixedWithIs: Allow boolean functions - #5285
    • Provide the current classpath inside KotlinEnvironmentResolver - #5275
    • Fix false-positive on NestedScopeFunctions - #5274
    • Use convention method to set task property defaults - #5272
    • Update docusaurus monorepo to v2.1.0 - #5270
    • detektVersionReplace.js plugin is not replacing all [detekt_version] tags on website - #5266
    • Update ktlint rule doc links - #5258
    • Remove redundant rule config for rules enabled by default - #5257
    • UnusedPrivateMember: fix false positive with backtick parameters - #5252
    • Improve MultilineRawStringIndentation - #5245
    • UnnecessaryLet: fix false positive with with invoke operator calls - #5240
    • Introduce baseline tooling api - #5239
    • Allow secondary constructors to reference CoroutineDispatchers - #5227
    • Update UnnecessaryAbstractClass issue description to be less verbose - #5224
    • Update plugin com.gradle.common-custom-user-data-gradle-plugin to v1.8.0 - #5223
    • Pin dependencies - #5222
    • Remove rule from NamingRules multi rule - #5212
    • Run all rules from EmptyBlocks multi rule individually - #5208
    • Run all rules from KDocStyle multi rule individually - #5207
    • Docs: GitHub - Add link to configure Sarif severity alert level - #5206
    • Fix errors with detektGenerateConfig - #5199
    • Forbid constructors with ForbiddenMethodCall - #5195
    • Update github/codeql-action digest to 2ca79b6 - #5177
    • Allow to ignore overloaded methods for the complex interface rule (#5165) - #5173
    • Add excludesRawStrings in MaxLineLength - #5171
    • Enable Predictive Test Selection for local builds - #5170
    • Update dependency org.kohsuke:github-api to v1.307 - #5168
    • Update dependency com.github.ajalt:clikt to v2.8.0 - #5167
    • Update docusaurus monorepo to v2.0.1 - #5166
    • Run build-logic Kotlin compilation out of process on CI - #5162
    • Add information about exhaustiveness check to documentation - #5160
    • Use getter when determining whether custom config path is set in DetektGenerateConfigTask - #5157
    • Limit Kotlin version warning suppression scope in build - #5156
    • Re-enable warnings as errors for detekt-gradle-plugin - #5155
    • Bundle slf4j-nop in detekt-formatting JAR - #5153
    • Fix false negative for UseRequire when thrown in conditional block - #5147
    • Allow parentheses for unclear precedence with range operator - #5143
    • Mark apiDump task as incompatible with configuration cache - #5134
    • Improve binding context management - #5130
    • RedundantExplicitType add annotation @RequiresTypeResolution - #5128
    • Disable ExitOutsideMain if contextBinding is empty - #5127
    • Use list config for DataClassContainsFunctions>conversionFunctionPrefix - #5119
    • Support proper globbing in ReturnCount - #5118
    • Improve finding message of ExplicitItLambdaParameter - #5117
    • Update JamesIves/github-pages-deploy-action digest to 13046b6 - #5110
    • UnusedUnaryOperator: fix false positive with var assignment and if expression - #5106
    • Tag publishPlugins task as incompatible with configuration cache - #5101
    • Make verifyGeneratorOutput task configuration cache compatible - #5100
    • Remove obsolete FeatureInAlphaState opt in - #5099
    • Remove explicit RequiresOptIn compiler flag - #5098
    • Use Gradle's configuration cache by default - #5095
    • Detect undocumented protected classes, properties, and functions - #5083
    • ReturnCount.excludedFunctions should be a List<String> - #5081
    • Make ForbiddenMethodCall to support property getters/setters and method references - #5078
    • Refactor Gradle tasks to use Gradle's managed properties - #4966
    • Add option to add a reason to ForbiddenMethodCall - #4910
    • UnnecessaryParentheses: add options to allow in ambiguous cases - #4881
    Dependency Updates
    • Update dependency com.android.tools.build:gradle to v7.3.1 - #5411
    • Update plugin com.gradle.enterprise to v3.11.2 - #5406
    • Update dependency org.jetbrains.dokka to v1.7.20 - #5401
    • Update dependency org.yaml:snakeyaml to v1.33 - #5354
    • Update dependency org.spekframework.spek2:spek-dsl-jvm to v2.0.19 - #5237
    • Update dependency com.android.tools.build:gradle to v7.2.2 - #5178
    • Update org.jetbrains.kotlinx - #5072
    • Update dependency org.jetbrains.dokka to v1.7.10 - #5070
    • Bump ktlint to version 0.46.1 - #5044
    • AssertJ 3.23.1 - #4265
    Housekeeping & Refactorings
    • Document and test edge cases for ForbiddenMethodCall function signatures - #5495
    • Fix invalid syntaxes in test code - #5446
    • Improve raw strings format - #5244
    • Enable trim multiline raw string - #5243
    • Remove old configurations - #5198
    • Improve tests in UnnecessaryParenthesesSpec - #5197
    • Remove multi rule FileParsingRule - #5193
    • Remove unused dry run properties from baseline/config tasks - #5158
    • remove SimpleGlob in favor of String.simplePatternToRegex() - #5144
    • Remove unused property - #5135
    • Assert end source locations - #5116
    • Forbid usage of DiagnosticUtils.getLineAndColumnInPsiFile - #5109
    • Configure 'ForbiddenImport' to use value and reason - #5105
    • Enable Kotlin's new approach to incremental compilation - #5092
    • Fix current indentation - #5059

    See all issues at: 1.22.0

    Source code(tar.gz)
    Source code(zip)
    detekt-cli-1.22.0-all.jar(62.50 MB)
    detekt-cli-1.22.0.zip(57.16 MB)
    detekt-formatting-1.22.0.jar(1.08 MB)
    detekt-generator-1.22.0-all.jar(63.78 MB)
    detekt-rules-libraries-1.22.0.jar(12.95 KB)
    detekt-rules-ruleauthors-1.22.0.jar(15.08 KB)
  • v1.22.0-RC3(Nov 6, 2022)

    1.22.0-RC3 - 2022-11-06

    Notable Changes
    • We're introducing the Detekt Marketplace, a place where you can add your own 3rd party extension such as rule, plugins, custom reporter, etc. - #5191
    • Our website is now versioned. You can find the changes for each version using the dropdown menu on the top bar. Documentation for the upcoming version (next) can be found here.
    • We added 16 new Rules to Detekt
      • AlsoCouldBeApply - #5333
      • MultilineRawStringIndentation - #5058
      • TrimMultilineRawString - #5051
      • UnnecessaryNotNullCheck - #5218
      • UnnecessaryPartOfBinaryExpression - #5203
      • UseSumOfInsteadOfFlatMapSize - #5405
      • FunctionReturnTypeSpacing from KtLint - #5256
      • FunctionSignature from KtLint - #5256
      • FunctionStartOfBodySpacing from KtLint - #5256
      • NullableTypeSpacing from KtLint - #5256
      • ParameterListSpacing from KtLint - #5256
      • SpacingBetweenFunctionNameAndOpeningParenthesis from KtLint - #5256
      • TrailingCommaOnCallSite from KtLint - #5312
      • TrailingCommaOnDeclarationSite from KtLint - #5312
      • TypeParameterListSpacing from KtLint - #5256
    • We added a new ruleset called detekt-rules-ruleauthors containing rules for Rule Authors to enforce best practices on Detekt rules such as the new ViolatesTypeResolutionRequirements - #5129 #5182
    • We added a new ruleset called detekt-rules-libraries containing rules mostly useful for Library Authors - We moved the following rules inside ForbiddenPublicDataClass, LibraryCodeMustSpecifyReturnType, LibraryEntitiesShouldNotBePublic this new ruleset - See Migration below on how to migrate #5360
    • We added support for JVM toolchain. This means that Detekt will now respect the JDK toolchain you specify on your Gradle configuration. You will also be able to specify a custom JDK home with the --jdk-home CLI parameter - #5269
    • Improvement for Type Resolution
      • We will now skip rules annotated with @RequiresTypeResolution when without Type Resolution - #5176
      • We will warn users if they run rules requiring Type Resolution when Type Resolution is disabled, so they're not silently skipped - #5226
    • Improvement for Config Management
      • We added exhaustiveness check during config validation. You can enable it checkExhaustiveness: true in your config file. This is disabled by default. - #5089
      • We added support for generating custom configuration for rule authors - #5080
    • Deprecations & Removals
      • We deprecated the MultiRule class as it was overly complicated. The suggested approach is to just provide separated rules. - #5161
      • The --fail-fast CLI flag (and failFast Gradle property) has been removed. It was deprecated since 1.16.x - #5290
      • We deprecated the following rules DuplicateCaseInWhenExpression, MissingWhenCase, RedundantElseInWhen as the Kotlin Compiler is already reporting errors for those scenarios - #5309
      • We removed the --print-ast CLI flag as PsiViewer provides the same features - #5418
    • Notable changes to existing rules
      • ArrayPrimitive is now working only with Type Resolution - #5175
      • WildcardImport is now running also on tests by default - #5121
      • ForbiddenImport allows now to specify a reason for every forbidden import - #4909
      • IgnoredReturnValue: option restrictToAnnotatedMethods is now deprecated in favor of restrictToConfig - #4922
    • This version of Detekt is built with Gradle v7.5.1, AGP 7.3.1, Kotlin 1.7.20 and KtLint 0.47.1 (see #5363 #5189 #5411 #5312
    • The minimum supported Gradle version is now v6.7.1 - #4964
    Migration

    We deprecated a number of rules in this release.

    You should update your config file as follows:

      potential-bugs:
        active: true
        ...
    -   DuplicateCaseInWhenExpression:
    -     active: true
        ...
    -   MissingWhenCase:
    -     active: true
    -     allowElseExpression: true
        ...
    -   RedundantElseInWhen:
    -     active: true
    
      style:
        active: true
        ...
    -   ForbiddenPublicDataClass:
    -     active: true
    -     excludes: ['**']
    -     ignorePackages:
    -       - '*.internal'
    -       - '*.internal.*'
        ...
    -   LibraryCodeMustSpecifyReturnType:
    -     active: true
    -     excludes: ['**']
        ...
    -   LibraryEntitiesShouldNotBePublic:
    -     active: true
    -     excludes: ['**']
    

    If you wish to use the libraries ruleset we introduced you should add the following to your config file:

    + libraries:
    +   active: true
    +   ForbiddenPublicDataClass:
    +     active: false
    +   LibraryEntitiesShouldNotBePublic:
    +     active: false
    +   LibraryCodeMustSpecifyReturnType:
    +     active: true
    

    and add the following to you build.gradle file:

    detektPlugins("io.gitlab.arturbosch.detekt:detekt-rules-authors:$version")
    

    If you're using our KtLint wrapper (i.e. detekt-formatting) you should also update your config file as follows:

    formatting:
      active: true
      ...
    - TrailingComma:
    -   active: false
    -   autoCorrect: true
    -   allowTrailingComma: false
    -   allowTrailingCommaOnCallSite: false
      ...
    + TrailingCommaOnCallSite:
    +   active: false
    +   autoCorrect: true
    +   useTrailingCommaOnCallSite: false
    + TrailingCommaOnDeclarationSite:
    +   active: false
    +   autoCorrect: true
    +   useTrailingCommaOnDeclarationSite: false
    
    Changelog
    • Fix issues introduced by #5152 - #5508
    • MultilineLambdaItParameter: fix false positive for one-line statements with a lambda argument - #5505
    • UseArrayLiteralsInAnnotations: fix false negative with primitive array factory calls - #5482
    • TrimMultilineRawString: fix false positive when it's expected as constant - #5480
    • Fix false negative SafeCast with no braces - #5479
    • Update gradle/wrapper-validation-action digest to 55e685c - #5472
    • Grant permission for type resolution Gradle job - #5470
    • Fix ObjectPropertyNaming Rule false positive - #5466
    • Fix LambdaParameterNaming rule false positive - #5465
    • Fix ReturnCount false positive when excludeReturnFromLambda is enabled - #5459
    • CognitiveComplexity: count else/else-if as one complexity - #5458
    • Fix false positive MultilineRawStringIndentation with tab indentation - #5453
    • Don't show the number of issues generating the BindingContext - #5449
    • Make detekt less noisy - #5448
    • New ruleauthors rule for Entity.from(x.nameIdentifier ?: x) -> Entity.atName(x) - #5444
    • Separating ComplexMethod rule into CyclomaticComplexMethod and CognitiveComplexMethod - #5442
    • Improve error reporting for CascadingCallWrapping - #5439
    • TrimMultilineRawString: fix false positive with not a raw string - #5438
    • BooleanPropertyNaming highlight only the name of the variable - #5431
    • Deprecate TrailingComma as it's now split in two rules - #5423
    • Remove unused constant - #5421
    • Report if/else as issue location instead of block - #5407
    • Remove some unnecessary suppressions - #5400
    • Check FormattingRule is auto-correctable by information provided by ktlint - #5398
    • Fix false negative MultilineLambdaItParameter on complex multiline single statement - #5397
    • ObjectPropertyNaming: fix false positive with top level properties - #5390
    • Remove usage of MPP targets function for JVM-only projects - #5383
    • UnnecessaryNotNullCheck: fix false negative with smart casted arguments - #5380
    • Add missing overlapping info & fix rules URLs - #5378
    • AlsoCouldBeApply: fix false positive when all statements are not it-started expressions - #5376
    • UnusedPrivateMember: fix false negative with named arguments - #5374
    • Change requires type resolution rule warning to debug level to not spam the user console - #5353
    • Report UseDataClass findings on class name - #5352
    • Report LabeledExpression as the label instead of the whole expression - #5351
    • Report CastToNullableType at the cast operator instead of the whole expression - #5350
    • Convert previously known string property to list based on default value - #5347
    • CastToNullableType: highlights too much - #5346
    • UseDataClass flags the whole class body, not just the name - #5338
    • CanBeNonNullable: explain why the rule does what it does. - #5332
    • Differentiate between correctable and non-correctable KtLint rules - #5324
    • ReturnCount 1.22.0 crashes on valid 1.21.0 config property excludedFunctions when using --all-rules cli flag - #5323
    • LabeledExpression to highlight only label - #5316
    • Use the correct source directory set on JVM - #5163
    • Get Android variant compile classpath from compileConfiguration - #5152
    • Use list config for FunctionOnlyReturningConstant>excludedFunctions - #5120
    • MaxLineLength: raw typo and test cleanup - #5315
    • EndOfSentenceFormat: fix HTML tag heuristic - #5313
    • Fix EndOfSentenceFormat highlight - #5311
    • Introduce configFile property on DetektGenerateTask - #5308
    • Improve debug suggestion message - #5300
    • Fat-Jar version of detekt-generator module - #5297
    • Toolchains docs - #5293
    • Adopt new AGP dsl - #5288
    • NonBooleanPropertyPrefixedWithIs: Allow boolean functions - #5285
    • Provide the current classpath inside KotlinEnvironmentResolver - #5275
    • Fix false-positive on NestedScopeFunctions - #5274
    • Use convention method to set task property defaults - #5272
    • Update docusaurus monorepo to v2.1.0 - #5270
    • detektVersionReplace.js plugin is not replacing all [detekt_version] tags on website - #5266
    • Update ktlint rule doc links - #5258
    • Remove redundant rule config for rules enabled by default - #5257
    • UnusedPrivateMember: fix false positive with backtick parameters - #5252
    • Improve MultilineRawStringIndentation - #5245
    • UnnecessaryLet: fix false positive with with invoke operator calls - #5240
    • Introduce baseline tooling api - #5239
    • Allow secondary constructors to reference CoroutineDispatchers - #5227
    • Update UnnecessaryAbstractClass issue description to be less verbose - #5224
    • Update plugin com.gradle.common-custom-user-data-gradle-plugin to v1.8.0 - #5223
    • Pin dependencies - #5222
    • Remove rule from NamingRules multi rule - #5212
    • Run all rules from EmptyBlocks multi rule individually - #5208
    • Run all rules from KDocStyle multi rule individually - #5207
    • Docs: GitHub - Add link to configure Sarif severity alert level - #5206
    • Fix errors with detektGenerateConfig - #5199
    • Forbid constructors with ForbiddenMethodCall - #5195
    • Update github/codeql-action digest to 2ca79b6 - #5177
    • Allow to ignore overloaded methods for the complex interface rule (#5165) - #5173
    • Add excludesRawStrings in MaxLineLength - #5171
    • Enable Predictive Test Selection for local builds - #5170
    • Update dependency org.kohsuke:github-api to v1.307 - #5168
    • Update dependency com.github.ajalt:clikt to v2.8.0 - #5167
    • Update docusaurus monorepo to v2.0.1 - #5166
    • Run build-logic Kotlin compilation out of process on CI - #5162
    • Add information about exhaustiveness check to documentation - #5160
    • Use getter when determining whether custom config path is set in DetektGenerateConfigTask - #5157
    • Limit Kotlin version warning suppression scope in build - #5156
    • Re-enable warnings as errors for detekt-gradle-plugin - #5155
    • Bundle slf4j-nop in detekt-formatting JAR - #5153
    • Fix false negative for UseRequire when thrown in conditional block - #5147
    • Allow parentheses for unclear precedence with range operator - #5143
    • Mark apiDump task as incompatible with configuration cache - #5134
    • Improve binding context management - #5130
    • RedundantExplicitType add annotation @RequiresTypeResolution - #5128
    • Disable ExitOutsideMain if contextBinding is empty - #5127
    • Use list config for DataClassContainsFunctions>conversionFunctionPrefix - #5119
    • Support proper globbing in ReturnCount - #5118
    • Improve finding message of ExplicitItLambdaParameter - #5117
    • Update JamesIves/github-pages-deploy-action digest to 13046b6 - #5110
    • UnusedUnaryOperator: fix false positive with var assignment and if expression - #5106
    • Tag publishPlugins task as incompatible with configuration cache - #5101
    • Make verifyGeneratorOutput task configuration cache compatible - #5100
    • Remove obsolete FeatureInAlphaState opt in - #5099
    • Remove explicit RequiresOptIn compiler flag - #5098
    • Use Gradle's configuration cache by default - #5095
    • Detect undocumented protected classes, properties, and functions - #5083
    • ReturnCount.excludedFunctions should be a List<String> - #5081
    • Make ForbiddenMethodCall to support property getters/setters and method references - #5078
    • Refactor Gradle tasks to use Gradle's managed properties - #4966
    • Add option to add a reason to ForbiddenMethodCall - #4910
    • UnnecessaryParentheses: add options to allow in ambiguous cases - #4881
    Dependency Updates
    • Update dependency com.android.tools.build:gradle to v7.3.1 - #5411
    • Update plugin com.gradle.enterprise to v3.11.2 - #5406
    • Update dependency org.jetbrains.dokka to v1.7.20 - #5401
    • Update dependency org.yaml:snakeyaml to v1.33 - #5354
    • Update dependency org.spekframework.spek2:spek-dsl-jvm to v2.0.19 - #5237
    • Update dependency com.android.tools.build:gradle to v7.2.2 - #5178
    • Update org.jetbrains.kotlinx - #5072
    • Update dependency org.jetbrains.dokka to v1.7.10 - #5070
    • Bump ktlint to version 0.46.1 - #5044
    • AssertJ 3.23.1 - #4265
    Housekeeping & Refactorings
    • Document and test edge cases for ForbiddenMethodCall function signatures - #5495
    • Fix invalid syntaxes in test code - #5446
    • Improve raw strings format - #5244
    • Enable trim multiline raw string - #5243
    • Remove old configurations - #5198
    • Improve tests in UnnecessaryParenthesesSpec - #5197
    • Remove multi rule FileParsingRule - #5193
    • Remove unused dry run properties from baseline/config tasks - #5158
    • remove SimpleGlob in favor of String.simplePatternToRegex() - #5144
    • Remove unused property - #5135
    • Assert end source locations - #5116
    • Forbid usage of DiagnosticUtils.getLineAndColumnInPsiFile - #5109
    • Configure 'ForbiddenImport' to use value and reason - #5105
    • Enable Kotlin's new approach to incremental compilation - #5092
    • Fix current indentation - #5059

    See all issues at: 1.22.0

    Source code(tar.gz)
    Source code(zip)
    detekt-cli-1.22.0-RC3-all.jar(62.45 MB)
    detekt-cli-1.22.0-RC3.zip(57.12 MB)
    detekt-formatting-1.22.0-RC3.jar(1.08 MB)
    detekt-generator-1.22.0-RC3-all.jar(63.73 MB)
    detekt-rules-libraries-1.22.0-RC3.jar(12.96 KB)
    detekt-rules-ruleauthors-1.22.0-RC3.jar(15.09 KB)
  • v1.22.0-RC2(Nov 7, 2022)

    Note: This Github Release was accidentally deleted as part of the RC3 release process. We've manually re-created it

    1.22.0-RC2 - 2022-10-16

    Notable Changes
    • We're introducing the Detekt Marketplace, a place where you can add your own 3rd party extension such as rule, plugins, custom reporter, etc. - #5191
    • Our website is now versioned. You can find the changes for each version using the dropdown menu on the top bar. Documentation for the upcoming version (next) can be found here.
    • We added 16 new Rules to Detekt
      • AlsoCouldBeApply - #5333
      • MultilineRawStringIndentation - #5058
      • TrimMultilineRawString - #5051
      • UnnecessaryNotNullCheck - #5218
      • UnnecessaryPartOfBinaryExpression - #5203
      • UseSumOfInsteadOfFlatMapSize - #5405
      • FunctionReturnTypeSpacing from KtLint - #5256
      • FunctionSignature from KtLint - #5256
      • FunctionStartOfBodySpacing from KtLint - #5256
      • NullableTypeSpacing from KtLint - #5256
      • ParameterListSpacing from KtLint - #5256
      • SpacingBetweenFunctionNameAndOpeningParenthesis from KtLint - #5256
      • TrailingCommaOnCallSite from KtLint - #5312
      • TrailingCommaOnDeclarationSite from KtLint - #5312
      • TypeParameterListSpacing from KtLint - #5256
    • We added a new ruleset called detekt-rules-ruleauthors containing rules for Rule Authors to enforce best practices on Detekt rules such as the new ViolatesTypeResolutionRequirements - #5129 #5182
    • We added a new ruleset called detekt-rules-libraries containing rules mostly useful for Library Authors - We moved the following rules inside ForbiddenPublicDataClass, LibraryCodeMustSpecifyReturnType, LibraryEntitiesShouldNotBePublic this new ruleset - See Migration below on how to migrate #5360
    • We added support for JVM toolchain. This means that Detekt will now respect the JDK toolchain you specify on your Gradle configuration. You will also be able to specify a custom JDK home with the --jdk-home CLI parameter - #5269
    • Improvement for Type Resolution
      • We will now skip rules annotated with @RequiresTypeResolution when without Type Resolution - #5176
      • We will warn users if they run rules requiring Type Resolution when Type Resolution is disabled, so they're not silently skipped - #5226
    • Improvement for Config Management
      • We added exhaustiveness check during config validation. You can enable it checkExhaustiveness: true in your config file. This is disabled by default. - #5089
      • We added support for generating custom configuration for rule authors - #5080
    • Deprecations & Removals
      • We deprecated the MultiRule class as it was overly complicated. The suggested approach is to just provide separated rules. - #5161
      • The --fail-fast CLI flag (and failFast Gradle property) has been removed. It was deprecated since 1.16.x - #5290
      • We deprecated the following rules DuplicateCaseInWhenExpression, MissingWhenCase, RedundantElseInWhen as the Kotlin Compiler is already reporting errors for those scenarios - #5309
    • Notable changes to existing rules
      • ArrayPrimitive is now working only with Type Resolution - #5175
      • WildcardImport is now running also on tests by default - #5121
      • ForbiddenImport allows now to specify a reason for every forbidden import - #4909
      • IgnoredReturnValue: option restrictToAnnotatedMethods is now deprecated in favor of restrictToConfig - #4922
    • This version of Detekt is built with Gradle v7.5.1, AGP 7.3.1, Kotlin 1.7.20 and KtLint 0.47.1 (see #5363 #5189 #5411 #5312
    • The minimum supported Gradle version is now v6.7.1 - #4964
    Migration

    We deprecated a number of rules in this release.

    You should update your config file as follows:

      potential-bugs:
        active: true
        ...
    -   DuplicateCaseInWhenExpression:
    -     active: true
        ...
    -   MissingWhenCase:
    -     active: true
    -     allowElseExpression: true
        ...
    -   RedundantElseInWhen:
    -     active: true
    
      style:
        active: true
        ...
    -   ForbiddenPublicDataClass:
    -     active: true
    -     excludes: ['**']
    -     ignorePackages:
    -       - '*.internal'
    -       - '*.internal.*'
        ...
    -   LibraryCodeMustSpecifyReturnType:
    -     active: true
    -     excludes: ['**']
        ...
    -   LibraryEntitiesShouldNotBePublic:
    -     active: true
    -     excludes: ['**']
    

    If you wish to use the libraries ruleset we introduced you should add the following to your config file:

    + libraries:
    +   active: true
    +   ForbiddenPublicDataClass:
    +     active: false
    +   LibraryEntitiesShouldNotBePublic:
    +     active: false
    +   LibraryCodeMustSpecifyReturnType:
    +     active: true
    

    and add the following to you build.gradle file:

    detektPlugins("io.gitlab.arturbosch.detekt:detekt-rules-authors:$version")
    

    If you're using our KtLint wrapper (i.e. detekt-formatting) you should also update your config file as follows:

    formatting:
      active: true
      ...
    - TrailingComma:
    -   active: false
    -   autoCorrect: true
    -   allowTrailingComma: false
    -   allowTrailingCommaOnCallSite: false
      ...
    + TrailingCommaOnCallSite:
    +   active: false
    +   autoCorrect: true
    +   useTrailingCommaOnCallSite: false
    + TrailingCommaOnDeclarationSite:
    +   active: false
    +   autoCorrect: true
    +   useTrailingCommaOnDeclarationSite: false
    
    Changelog
    • Remove unused constant - #5421
    • Report if/else as issue location instead of block - #5407
    • Remove some unnecessary suppressions - #5400
    • Check FormattingRule is auto-correctable by information provided by ktlint - #5398
    • Fix false negative MultilineLambdaItParameter on complex multiline single statement - #5397
    • ObjectPropertyNaming: fix false positive with top level properties - #5390
    • Remove usage of MPP targets function for JVM-only projects - #5383
    • UnnecessaryNotNullCheck: fix false negative with smart casted arguments - #5380
    • Add missing overlapping info & fix rules URLs - #5378
    • AlsoCouldBeApply: fix false positive when all statements are not it-started expressions - #5376
    • UnusedPrivateMember: fix false negative with named arguments - #5374
    • Change requires type resolution rule warning to debug level to not spam the user console - #5353
    • Report UseDataClass findings on class name - #5352
    • Report LabeledExpression as the label instead of the whole expression - #5351
    • Report CastToNullableType at the cast operator instead of the whole expression - #5350
    • Convert previously known string property to list based on default value - #5347
    • CastToNullableType: highlights too much - #5346
    • UseDataClass flags the whole class body, not just the name - #5338
    • CanBeNonNullable: explain why the rule does what it does. - #5332
    • Differentiate between correctable and non-correctable KtLint rules - #5324
    • ReturnCount 1.22.0 crashes on valid 1.21.0 config property excludedFunctions when using --all-rules cli flag - #5323
    • LabeledExpression to highlight only label - #5316
    • Use the correct source directory set on JVM - #5163
    • Get Android variant compile classpath from compileConfiguration - #5152
    • Use list config for FunctionOnlyReturningConstant>excludedFunctions - #5120
    • MaxLineLength: raw typo and test cleanup - #5315
    • EndOfSentenceFormat: fix HTML tag heuristic - #5313
    • Fix EndOfSentenceFormat highlight - #5311
    • Introduce configFile property on DetektGenerateTask - #5308
    • Improve debug suggestion message - #5300
    • Fat-Jar version of detekt-generator module - #5297
    • Toolchains docs - #5293
    • Adopt new AGP dsl - #5288
    • NonBooleanPropertyPrefixedWithIs: Allow boolean functions - #5285
    • Provide the current classpath inside KotlinEnvironmentResolver - #5275
    • Fix false-positive on NestedScopeFunctions - #5274
    • Use convention method to set task property defaults - #5272
    • Update docusaurus monorepo to v2.1.0 - #5270
    • detektVersionReplace.js plugin is not replacing all [detekt_version] tags on website - #5266
    • Update ktlint rule doc links - #5258
    • Remove redundant rule config for rules enabled by default - #5257
    • UnusedPrivateMember: fix false positive with backtick parameters - #5252
    • Improve MultilineRawStringIndentation - #5245
    • UnnecessaryLet: fix false positive with with invoke operator calls - #5240
    • Introduce baseline tooling api - #5239
    • Allow secondary constructors to reference CoroutineDispatchers - #5227
    • Update UnnecessaryAbstractClass issue description to be less verbose - #5224
    • Update plugin com.gradle.common-custom-user-data-gradle-plugin to v1.8.0 - #5223
    • Pin dependencies - #5222
    • Remove rule from NamingRules multi rule - #5212
    • Run all rules from EmptyBlocks multi rule individually - #5208
    • Run all rules from KDocStyle multi rule individually - #5207
    • Docs: GitHub - Add link to configure Sarif severity alert level - #5206
    • Fix errors with detektGenerateConfig - #5199
    • Forbid constructors with ForbiddenMethodCall - #5195
    • Update github/codeql-action digest to 2ca79b6 - #5177
    • Allow to ignore overloaded methods for the complex interface rule (#5165) - #5173
    • Add excludesRawStrings in MaxLineLength - #5171
    • Enable Predictive Test Selection for local builds - #5170
    • Update dependency org.kohsuke:github-api to v1.307 - #5168
    • Update dependency com.github.ajalt:clikt to v2.8.0 - #5167
    • Update docusaurus monorepo to v2.0.1 - #5166
    • Run build-logic Kotlin compilation out of process on CI - #5162
    • Add information about exhaustiveness check to documentation - #5160
    • Use getter when determining whether custom config path is set in DetektGenerateConfigTask - #5157
    • Limit Kotlin version warning suppression scope in build - #5156
    • Re-enable warnings as errors for detekt-gradle-plugin - #5155
    • Bundle slf4j-nop in detekt-formatting JAR - #5153
    • Fix false negative for UseRequire when thrown in conditional block - #5147
    • Allow parentheses for unclear precedence with range operator - #5143
    • Mark apiDump task as incompatible with configuration cache - #5134
    • Improve binding context management - #5130
    • RedundantExplicitType add annotation @RequiresTypeResolution - #5128
    • Disable ExitOutsideMain if contextBinding is empty - #5127
    • Use list config for DataClassContainsFunctions>conversionFunctionPrefix - #5119
    • Support proper globbing in ReturnCount - #5118
    • Improve finding message of ExplicitItLambdaParameter - #5117
    • Update JamesIves/github-pages-deploy-action digest to 13046b6 - #5110
    • UnusedUnaryOperator: fix false positive with var assignment and if expression - #5106
    • Tag publishPlugins task as incompatible with configuration cache - #5101
    • Make verifyGeneratorOutput task configuration cache compatible - #5100
    • Remove obsolete FeatureInAlphaState opt in - #5099
    • Remove explicit RequiresOptIn compiler flag - #5098
    • Use Gradle's configuration cache by default - #5095
    • Detect undocumented protected classes, properties, and functions - #5083
    • ReturnCount.excludedFunctions should be a List<String> - #5081
    • Make ForbiddenMethodCall to support property getters/setters and method references - #5078
    • Refactor Gradle tasks to use Gradle's managed properties - #4966
    • Add option to add a reason to ForbiddenMethodCall - #4910
    • UnnecessaryParentheses: add options to allow in ambiguous cases - #4881
    Dependency Updates
    • Update dependency com.android.tools.build:gradle to v7.3.1 - #5411
    • Update plugin com.gradle.enterprise to v3.11.2 - #5406
    • Update dependency org.jetbrains.dokka to v1.7.20 - #5401
    • Update dependency org.yaml:snakeyaml to v1.33 - #5354
    • Update dependency org.spekframework.spek2:spek-dsl-jvm to v2.0.19 - #5237
    • Update dependency com.android.tools.build:gradle to v7.2.2 - #5178
    • Update org.jetbrains.kotlinx - #5072
    • Update dependency org.jetbrains.dokka to v1.7.10 - #5070
    • Bump ktlint to version 0.46.1 - #5044
    • AssertJ 3.23.1 - #4265
    Housekeeping & Refactorings
    • Improve raw strings format - #5244
    • Enable trim multiline raw string - #5243
    • Remove old configurations - #5198
    • Improve tests in UnnecessaryParenthesesSpec - #5197
    • Remove multi rule FileParsingRule - #5193
    • Remove unused dry run properties from baseline/config tasks - #5158
    • remove SimpleGlob in favor of String.simplePatternToRegex() - #5144
    • Remove unused property - #5135
    • Assert end source locations - #5116
    • Forbid usage of DiagnosticUtils.getLineAndColumnInPsiFile - #5109
    • Configure 'ForbiddenImport' to use value and reason - #5105
    • Enable Kotlin's new approach to incremental compilation - #5092
    • Fix current indentation - #5059

    See all issues at: 1.22.0

    Source code(tar.gz)
    Source code(zip)
    detekt-cli-1.22.0-RC2-all.jar(62.45 MB)
    detekt-cli-1.22.0-RC2.zip(57.12 MB)
    detekt-formatting-1.22.0-RC2.jar(1.08 MB)
    detekt-generator-1.22.0-RC2-all.jar(63.73 MB)
    detekt-rules-libraries-1.22.0-RC2.jar(13.02 KB)
    detekt-rules-ruleauthors-1.22.0-RC2.jar(12.26 KB)
  • v1.22.0-RC1(Sep 21, 2022)

    1.22.0-RC1 - 2022-09-19

    Notable Changes
    • Our website is now versioned. You can find the changes for each version using the dropdown menu on the top bar. Documentation for the upcoming version (next) can be found here.
    • We added 10 new Rules to Detekt
      • MultilineRawStringIndentation - #5058
      • TrimMultilineRawString - #5051
      • UnnecessaryPartOfBinaryExpression - #5203
      • FunctionReturnTypeSpacing from KtLint - #5256
      • FunctionSignature from KtLint - #5256
      • FunctionStartOfBodySpacing from KtLint - #5256
      • NullableTypeSpacing from KtLint - #5256
      • ParameterListSpacing from KtLint - #5256
      • SpacingBetweenFunctionNameAndOpeningParenthesis from KtLint - #5256
      • TypeParameterListSpacing from KtLint - #5256
    • We added a new ruleset called detekt-rules-ruleauthors containing rules for Rule Authors to enforce best practices on Detetk rules - #5129
    • We added support for JVM toolchain. This means that Detekt will now respect the JDK toolchain you specify on your Gradle configuration. You will also be able to specify a custom JDK home with the --jdk-home CLI parameter - #5269
    • Improvement for Type Resolution
      • We will now skip rules annotated with @RequiresTypeResolution when without Type Resolution - #5176
      • We will warn users if they run rules requiring Type Resolution when Type Resolution is disabled, so they're not silently skipped - #5226
    • Improvement for Config Management
      • We added exhaustiveness check during config validation. You can enable it checkExhaustiveness: true in your config file. This is disabled by default. - #5089
      • We added support for generating custom configuration for rule authors - #5080
    • Deprecations & Removals
      • We deprecated the MultiRule class as it was overly complicated. The suggested approach is to just provide separated rules. - #5161
      • The --fail-fast CLI flag (and failFast Gradle property) has been remove. It was deprecated since 1.16.x - #5290
    • Notable changes to existing rules
      • ArrayPrimitive is now working only with Type Resolution - #5175
      • WildcardImport is now running also on tests by default - #5121
      • ForbiddenImport allows now to specify a reason for every forbidden import - #4909
    • This version of Detekt is built with Gradle v7.5.1, AGP 7.3.0 and Kotlin 1.7.10 (see #4821 #5189 #5306)
    • The minimum supported Gradle version is now v6.7.1 - #4964
    Changelog
    • Use list config for FunctionOnlyReturningConstant>excludedFunctions - #5120
    • MaxLineLength: raw typo and test cleanup - #5315
    • EndOfSentenceFormat: fix HTML tag heuristic - #5313
    • Fix EndOfSentenceFormat highlight - #5311
    • Introduce configFile property on DetektGenerateTask - #5308
    • Improve debug suggestion message - #5300
    • Fat-Jar version of detekt-generator module - #5297
    • Toolchains docs - #5293
    • Adopt new AGP dsl - #5288
    • NonBooleanPropertyPrefixedWithIs: Allow boolean functions - #5285
    • Provide the current classpath inside KotlinEnvironmentResolver - #5275
    • Fix false-positive on NestedScopeFunctions - #5274
    • Use convention method to set task property defaults - #5272
    • Update docusaurus monorepo to v2.1.0 - #5270
    • detektVersionReplace.js plugin is not replacing all [detekt_version] tags on website - #5266
    • Update ktlint rule doc links - #5258
    • Remove redundant rule config for rules enabled by default - #5257
    • UnusedPrivateMember: fix false positive with backtick parameters - #5252
    • Improve MultilineRawStringIndentation - #5245
    • UnnecessaryLet: fix false positive with with invoke operator calls - #5240
    • Introduce baseline tooling api - #5239
    • Allow secondary constructors to reference CoroutineDispatchers - #5227
    • Update UnnecessaryAbstractClass issue description to be less verbose - #5224
    • Update plugin com.gradle.common-custom-user-data-gradle-plugin to v1.8.0 - #5223
    • Pin dependencies - #5222
    • Remove rule from NamingRules multi rule - #5212
    • Run all rules from EmptyBlocks multi rule individually - #5208
    • Run all rules from KDocStyle multi rule individually - #5207
    • Docs: GitHub - Add link to configure Sarif severity alert level - #5206
    • Fix errors with detektGenerateConfig - #5199
    • Forbid constructors with ForbiddenMethodCall - #5195
    • Update github/codeql-action digest to 2ca79b6 - #5177
    • Allow to ignore overloaded methods for the complex interface rule (#5165) - #5173
    • Add excludesRawStrings in MaxLineLength - #5171
    • Enable Predictive Test Selection for local builds - #5170
    • Update dependency org.kohsuke:github-api to v1.307 - #5168
    • Update dependency com.github.ajalt:clikt to v2.8.0 - #5167
    • Update docusaurus monorepo to v2.0.1 - #5166
    • Run build-logic Kotlin compilation out of process on CI - #5162
    • Add information about exhaustiveness check to documentation - #5160
    • Use getter when determining whether custom config path is set in DetektGenerateConfigTask - #5157
    • Limit Kotlin version warning suppression scope in build - #5156
    • Re-enable warnings as errors for detekt-gradle-plugin - #5155
    • Bundle slf4j-nop in detekt-formatting JAR - #5153
    • Fix false negative for UseRequire when thrown in conditional block - #5147
    • Allow parentheses for unclear precedence with range operator - #5143
    • Mark apiDump task as incompatible with configuration cache - #5134
    • Improve binding context management - #5130
    • RedundantExplicitType add annotation @RequiresTypeResolution - #5128
    • Disable ExitOutsideMain if contextBinding is empty - #5127
    • Use list config for DataClassContainsFunctions>conversionFunctionPrefix - #5119
    • Support proper globbing in ReturnCount - #5118
    • Improve finding message of ExplicitItLambdaParameter - #5117
    • Update JamesIves/github-pages-deploy-action digest to 13046b6 - #5110
    • UnusedUnaryOperator: fix false positive with var assignment and if expression - #5106
    • Tag publishPlugins task as incompatible with configuration cache - #5101
    • Make verifyGeneratorOutput task configuration cache compatible - #5100
    • Remove obsolete FeatureInAlphaState opt in - #5099
    • Remove explicit RequiresOptIn compiler flag - #5098
    • Use Gradle's configuration cache by default - #5095
    • Detect undocumented protected classes, properties, and functions - #5083
    • ReturnCount.excludedFunctions should be a List<String> - #5081
    • Make ForbiddenMethodCall to support property getters/setters and method references - #5078
    • Refactor Gradle tasks to use Gradle's managed properties - #4966
    • IgnoredReturnValue: add option returnValueTypes to enable rule for particular types - #4922
    • Add option to add a reason to ForbiddenMethodCall - #4910
    • UnnecessaryParentheses: add options to allow in ambiguous cases - #4881
    Dependency Updates
    • Update dependency org.spekframework.spek2:spek-dsl-jvm to v2.0.19 - #5237
    • Update dependency com.android.tools.build:gradle to v7.2.2 - #5178
    • Update org.jetbrains.kotlinx - #5072
    • Update dependency org.jetbrains.dokka to v1.7.10 - #5070
    • Bump ktlint to version 0.46.1 - #5044
    • AssertJ 3.23.1 - #4265
    Housekeeping & Refactorings
    • Improve raw strings format - #5244
    • Enable trim multiline raw string - #5243
    • Remove old configurations - #5198
    • Improve tests in UnnecessaryParenthesesSpec - #5197
    • Remove multi rule FileParsingRule - #5193
    • Remove unused dry run properties from baseline/config tasks - #5158
    • remove SimpleGlob in favor of String.simplePatternToRegex() - #5144
    • Remove unused property - #5135
    • Assert end source locations - #5116
    • Forbid usage of DiagnosticUtils.getLineAndColumnInPsiFile - #5109
    • Configure 'ForbiddenImport' to use value and reason - #5105
    • Enable Kotlin's new approach to incremental compilation - #5092
    • Fix current indentation - #5059

    See all issues at: 1.22.0

    Source code(tar.gz)
    Source code(zip)
    detekt-cli-1.22.0-RC1-all.jar(61.54 MB)
    detekt-cli-1.22.0-RC1.zip(56.29 MB)
    detekt-formatting-1.22.0-RC1.jar(990.29 KB)
    detekt-generator-1.22.0-RC1-all.jar(62.70 MB)
    detekt-rules-ruleauthors-1.22.0-RC1.jar(2.64 KB)
  • v1.21.0(Jul 17, 2022)

    We're delighted to announce the next upcoming stable release of Detekt: 1.21.0 🎉 This release is coming with 6 new rules, new API and functionalities and several stability improvements.

    We want to thank you very much our Sponsors for the support in those last months. The work behind Detekt is all happening on a voluntary basis, and we're more than grateful for all the support we get from the Open Source Ecosystem.

    We're also excited to announce that we're now having an Open Source Gradle Enterprise instance. When building the Detekt projects, you'll benefit from the Gradle Remote Cache that this instance is providing!

    Finally, we want to take the opportunity to thank our contributors for testing, bug reporting and helping us release this new version of Detekt. You're more than welcome to join our community on the #detekt channel on KotlinLang's Slack (you can get an invite here).

    Notable Changes

    • We enabled ~30 new rules by default which we believe are now stable enough. - #4875
    • We added 7 new Rules to Detekt
      • NullableBooleanCheck - #4872
      • CouldBeSequence - #4855
      • UnnecessaryBackticks - #4764
      • ForbiddenSuppress - #4899
      • MaxChainedCallsOnSameLine - #4985
      • CascadingCallWrapping - #4979
      • NestedScopeFunctions - #4788
    • We added support for Markdown reports - #4858
    • We now allow users and rule authors to specify a reason for every value in the config file - #4611 - Please note that this feature requires a rule to be extended to support it. If you're a rule author you can start using it right away in your rule. We're looking into using this feature in some first party rule starting from Detekt 1.22.0.
    • We now report as warnings the Strings in the config file that can be converted to be an array - #4793
    • We added a dependency on ConTester to help us verify concurrency scenarios for Detekt - #4672
    • For contributors: we restructured our build setup to be use Gradle composite build - #4751

    Migration

    We fixed a bug related to function with KDocs and how their location in the source code was calculated (see #4961 and #4887).

    Because of this, some users might have to recreate their baseline as the location of such functions are not matched anymore against the baseline. You can do so by deleting your old baseline and invoking the detektBaseline task (or the corresponding task, based on your configuration).

    Changelog

    • ReturnCount: Make configuration parameter more explicit - #5062
    • Remove redundant null check - #5061
    • Drop redundant Gradle workaround - #5057
    • Update ktlint links from website to readme - #5056
    • Improve extensions.doc format with admonitions - #5055
    • Update docusaurus monorepo to v2.0.0-beta.22 - #5050
    • Enable strict Kotlin DSL precompiled script plugins accessors generation - #5048
    • MaxChainedCallsOnSameLine: don't count package references as chained calls - #5036
    • Xml Report Merger now merges duplicate smells across input report files - #5033
    • Add ending line and column to Location.kt - #5032
    • Fix type resolution link in Contributing.md - #5027
    • #5014 Fix MaxChainedCallsOnSameLine false positives - #5020
    • Add endColumn/endLine to SARIF region - #5011
    • Removed UnnecessaryAbstractClass if it inherits from a abstract class - #5009
    • Only recommend using index accessors for Java classes that are known collections - #4994
    • UnusedImports: fix false positive for unresolved imports - #4882
    • Fix Signatures.kt:buildFunctionSignature - #4961
    • Loading a specific resource from a module must use class from module - #5008
    • Update github/codeql-action digest to 3f62b75 - #5007
    • Show finding at declaration name instead of the whole declaration - #5003
    • NamedArguments: don't count trailing lambda argument - #5002
    • Address TextLocation for Wrapping - #4998
    • Support markdown report in Gradle plugin - #4995
    • Fix false-negative for CanBeNonNullable - #4993
    • Give a better error message for --jvm-target - #4978
    • Fix rule code samples to be valid Kotlin code - #4969
    • Use plain ASCII output in standard reports - #4968
    • UnnecessaryApply: fix false negative for assignment - #4948
    • Support disabling config validation via tooling spec - #4937
    • UnusedPrivateMember: highlight declaration name - #4928
    • Provide a priority field for DetektProvider - #4923
    • CastToNullableType: allow casting null keyword - #4907
    • Update plugin com.gradle.common-custom-user-data-gradle-plugin to v1.7.2 - #4897
    • Set strict dependency on tested Kotlin compiler version - #4822
    • Simplify regular expressions - #4893
    • Remove redundant character escape in RegExp - #4892
    • Reformat Markdown files to comply with the spec - #4891
    • UnnecessaryInnerClass: fix false negative with this references - #4884
    • UselessCallOnNotNull: fix false positive for unresolved types - #4880
    • Update MagicNumber rule to exclude .kts files - #4877
    • CanBeNonNullable: fix false positives for parameterized types - #4870
    • UnnecessaryInnerClass: fix false positives labeled expression to outer class - #4865
    • UnnecessaryInnerClass: add test for safe qualified expressions - #4864
    • Fix a confusing Regex in the Compose webpage - #4852
    • Fix edit URLs for the website - #4850
    • detektGenerateConfig adds the configuration of plugins - #4844
    • Update dependency prism-react-renderer to v1.3.3 - #4833
    • Search in all versions.properties, not just the first one #4830 - #4831
    • Improve exception message - #4823
    • Fix ValShouldBeVar false positive inside unknown type - #4820
    • Add a recent conference talk link - #4819
    • False positive for unused imports #4815 - #4818
    • Revert "Display dynamic --jvm-target values when using --help flag (#4694)" - #4816
    • UnnecessaryAbstractClass: report only the class name - #4808
    • Fix wrong replacement suggestion for UnnecessaryFilter - #4807
    • UseOrEmpty: fix false positive for indexing operator calls with type parameters - #4804
    • ExplicitCollectionElementAccessMethod: fix false positive for get operators with type parameters - #4803
    • Add tests for #4786 - #4801
    • Add documentation link for rules in html report - #4799
    • Improve rule documentaion and smell message of NamedArguments - #4796
    • Improve issue description and smell message of DestructuringDeclarationWithTooManyEntries - #4795
    • NestedScopeFunctions - Add rule for nested scope functions - #4788
    • Partially drop redundant usage of "dry run" in Gradle plugin tests - #4776
    • Allow additionalJavaSourceRootPaths to be defined on @KotlinCoreEnvironmentTest - #4771
    • Report KDoc comments that refer to non-public properties of a class - #4768
    • Self-inspect the detekt-gradle-plugin - #4765
    • Pass args to DetektInvoker as List<String> - #4762
    • Cleanup Gradle Plugin Publications - #4752
    • Break a dependency between detekt-gradle-plugin and detekt-utils - #4748
    • Remove suspend lambda rule with CoroutineScope receiver due to not de… - #4747
    • VarCouldBeVal: Add configuration flag ignoreLateinitVar - #4745
    • UnnecessaryInnerClass: fix false positive with references to function type variables - #4738
    • Fix false positive on VarCouldBeVal in generic classes - #4733
    • OutdatedDocumentation: fix false positive with no primary constructor - #4728
    • Android Gradle: add javac intermediates to classpath - #4723
    • OptionalWhenBraces: fix false negative when the single statement has comments inside - #4722
    • Document pre-commit hook for staged files - #4711
    • Enable rules by default for 1.21 - #4643

    Dependency Updates

    • Update dependency gradle to v7.5 - #5074
    • Update plugin binaryCompatibilityValidator to v0.11.0 - #5069
    • Update dependency org.jetbrains.kotlinx:kotlinx-coroutines-core to v1.6.3 - #4976
    • Update dependency org.jetbrains.dokka to v1.7.0 - #4974
    • Update plugin binaryCompatibilityValidator to v0.10.1 - #4954
    • Update dependency org.jetbrains.kotlinx:kotlinx-coroutines-core to v1.6.2 - #4868
    • Update dependency com.android.tools.build:gradle to v7.2.1 - #4861
    • Update plugin binaryCompatibilityValidator to v0.10.0 - #4837
    • Update dependency io.mockk:mockk to v1.12.4 - #4829
    • Update dependency com.android.tools.build:gradle to v7.2.0 - #4824
    • Add dependency-analysis plugin and implement some recommendations - #4798
    • Add dependency on slf4j-nop to silence warning - #4775
    • Update plugin dokka to v1.6.21 - #4770
    • Update org.jetbrains.kotlin to v1.6.21 - #4737
    • Update dependency com.github.breadmoirai:github-release to v2.3.7 - #4734
    • Update plugin binaryCompatibilityValidator to v0.9.0 - #4729

    Housekeeping & Refactorings

    • Fix ComplexMethod debt and refactor code - #5029
    • Fix ReturnCount debt and refactor code - #5026
    • Add test for ForbiddenMethodCall with getters - #5018
    • Measure flakyness on Windows CI - #4742
    • Declare nested test classes as non-static - #4894
    • Remove deprecated usages in gradle-plugin test - #4889
    • Remove reference to contributor list - #4871
    • Add missing image - #4834
    • Upgrade to GE enterprise 3.10 - #4802
    • Fix broken snapshot publishing - #4783
    • Remove pending Gradle version milestones from comments - #4777
    • Add more tests for Annotation Suppressor - #4774
    • fix: add test case that fails if environment is not properly set up - #4769
    • Disable UnusedImports for the Detekt project - #4741
    • Remove Unnecesary @Nested - #4740
    • Update the argsfile to unblock runWithArgsFile failing locally - #4718

    See all issues at: 1.21.0

    Source code(tar.gz)
    Source code(zip)
    detekt-cli-1.21.0-all.jar(60.94 MB)
    detekt-cli-1.21.0.zip(55.73 MB)
    detekt-formatting-1.21.0.jar(910.11 KB)
  • v1.21.0-RC2(Jul 17, 2022)

    1.21.0-RC2 - 2022-06-29

    Notable Changes

    • We enabled ~30 new rules by default which we believe are now stable enough. - #4875
    • We added 6 new Rules to Detekt
      • NullableBooleanCheck - #4872
      • CouldBeSequence - #4855
      • UnnecessaryBackticks - #4764
      • ForbiddenSuppress - #4899
      • MaxChainedCallsOnSameLine - #4985
      • CascadingCallWrapping - #4979
    • We added support for Markdown reports - #4858
    • We now allow users and rule authors to specify a reason for every value in the config file - #4611
    • We now report as warnings the in the config file that can be converted to be an array - #4793
    • We added a dependency on ConTester to help us verify concurrency scenarios for Detekt - #4672
    • For contributors: we restructured our build setup to be use Gradle composite build - #4751

    Changelog

    • Fix Signatures.kt:buildFunctionSignature - #4961
    • Loading a specific resource from a module must use class from module - #5008
    • Update github/codeql-action digest to 3f62b75 - #5007
    • Show finding at declaration name instead of the whole declaration - #5003
    • NamedArguments: don't count trailing lambda argument - #5002
    • Address TextLocation for Wrapping - #4998
    • Support markdown report in Gradle plugin - #4995
    • Fix false-negative for CanBeNonNullable - #4993
    • Give a better error message for --jvm-target - #4978
    • Fix rule code samples to be valid Kotlin code - #4969
    • Use plain ASCII output in standard reports - #4968
    • UnnecessaryApply: fix false negative for assignment - #4948
    • Support disabling config validation via tooling spec - #4937
    • UnusedPrivateMember: highlight declaration name - #4928
    • Provide a priority field for DetektProvider - #4923
    • CastToNullableType: allow casting null keyword - #4907
    • Update plugin com.gradle.common-custom-user-data-gradle-plugin to v1.7.2 - #4897
    • Set strict dependency on tested Kotlin compiler version - #4822
    • Simplify regular expressions - #4893
    • Remove redundant character escape in RegExp - #4892
    • Reformat Markdown files to comply with the spec - #4891
    • UnnecessaryInnerClass: fix false negative with this references - #4884
    • UselessCallOnNotNull: fix false positive for unresolved types - #4880
    • Update MagicNumber rule to exclude .kts files - #4877
    • CanBeNonNullable: fix false positives for parameterized types - #4870
    • UnnecessaryInnerClass: fix false positives labeled expression to outer class - #4865
    • UnnecessaryInnerClass: add test for safe qualified expressions - #4864
    • Fix a confusing Regex in the Compose webpage - #4852
    • Fix edit URLs for the website - #4850
    • detektGenerateConfig adds the configuration of plugins - #4844
    • Update dependency prism-react-renderer to v1.3.3 - #4833
    • Search in all versions.properties, not just the first one #4830 - #4831
    • Improve exception message - #4823
    • Fix ValShouldBeVar false positive inside unknown type - #4820
    • Add a recent conference talk link - #4819
    • False positive for unused imports #4815 - #4818
    • Revert "Display dynamic --jvm-target values when using --help flag (#4694)" - #4816
    • UnnecessaryAbstractClass: report only the class name - #4808
    • Fix wrong replacement suggestion for UnnecessaryFilter - #4807
    • UseOrEmpty: fix false positive for indexing operator calls with type parameters - #4804
    • ExplicitCollectionElementAccessMethod: fix false positive for get operators with type parameters - #4803
    • Add tests for #4786 - #4801
    • Add documentation link for rules in html report - #4799
    • Improve rule documentaion and smell message of NamedArguments - #4796
    • Improve issue description and smell message of DestructuringDeclarationWithTooManyEntries - #4795
    • NestedScopeFunctions - Add rule for nested scope functions - #4788
    • Partially drop redundant usage of "dry run" in Gradle plugin tests - #4776
    • Allow additionalJavaSourceRootPaths to be defined on @KotlinCoreEnvironmentTest - #4771
    • Report KDoc comments that refer to non-public properties of a class - #4768
    • Self-inspect the detekt-gradle-plugin - #4765
    • Pass args to DetektInvoker as List<String> - #4762
    • Cleanup Gradle Plugin Publications - #4752
    • Break a dependency between detekt-gradle-plugin and detekt-utils - #4748
    • Remove suspend lambda rule with CoroutineScope receiver due to not de… - #4747
    • VarCouldBeVal: Add configuration flag ignoreLateinitVar - #4745
    • UnnecessaryInnerClass: fix false positive with references to function type variables - #4738
    • Fix false positive on VarCouldBeVal in generic classes - #4733
    • OutdatedDocumentation: fix false positive with no primary constructor - #4728
    • Android Gradle: add javac intermediates to classpath - #4723
    • OptionalWhenBraces: fix false negative when the single statement has comments inside - #4722
    • Document pre-commit hook for staged files - #4711
    • Enable rules by default for 1.21 - #4643

    Dependency Updates

    • Update dependency org.jetbrains.kotlinx:kotlinx-coroutines-core to v1.6.3 - #4976
    • Update dependency org.jetbrains.dokka to v1.7.0 - #4974
    • Update plugin binaryCompatibilityValidator to v0.10.1 - #4954
    • Update dependency org.jetbrains.kotlinx:kotlinx-coroutines-core to v1.6.2 - #4868
    • Update dependency com.android.tools.build:gradle to v7.2.1 - #4861
    • Update plugin binaryCompatibilityValidator to v0.10.0 - #4837
    • Update dependency io.mockk:mockk to v1.12.4 - #4829
    • Update dependency com.android.tools.build:gradle to v7.2.0 - #4824
    • Add dependency-analysis plugin and implement some recommendations - #4798
    • Add dependency on slf4j-nop to silence warning - #4775
    • Update plugin dokka to v1.6.21 - #4770
    • Update org.jetbrains.kotlin to v1.6.21 - #4737
    • Update dependency com.github.breadmoirai:github-release to v2.3.7 - #4734
    • Update plugin binaryCompatibilityValidator to v0.9.0 - #4729

    Housekeeping & Refactorings

    • Measure flakyness on Windows CI - #4742
    • Declare nested test classes as non-static - #4894
    • Remove deprecated usages in gradle-plugin test - #4889
    • Remove reference to contributor list - #4871
    • Add missing image - #4834
    • Upgrade to GE enterprise 3.10 - #4802
    • Fix broken snapshot publishing - #4783
    • Remove pending Gradle version milestones from comments - #4777
    • Add more tests for Annotation Suppressor - #4774
    • fix: add test case that fails if environment is not properly set up - #4769
    • Disable UnusedImports for the Detekt project - #4741
    • Remove Unnecesary @Nested - #4740
    • Update the argsfile to unblock runWithArgsFile failing locally - #4718

    See all issues at: 1.21.0

    Source code(tar.gz)
    Source code(zip)
    detekt-cli-1.21.0-RC2-all.jar(60.93 MB)
    detekt-cli-1.21.0-RC2.zip(55.72 MB)
    detekt-formatting-1.21.0-RC2.jar(910.12 KB)
  • v1.21.0-RC1(Jun 3, 2022)

    v1.21.0-RC1 - 2022-06-02

    Notable Changes

    • We enabled ~30 new rules by default which we believe are now stable enough. - #4875
    • We added 3 new Rules to Detekt
      • NullableBooleanCheck - #4872
      • CouldBeSequence - #4855
      • UnnecessaryBackticks - #4764
    • We now allow users and rule authors to specify a reason for every value in the config file - #4611
    • We now report as warnings the in the config file that should converted to be an array - #4793
    • We added a dependency on ConTester to help us verify concurrency scenarios for Detekt - #4672
    • For contributors: we restructured our build setup to be use Gradle composite build - #4751

    Changelog

    • Simplify regular expressions - #4893
    • Remove redundant character escape in RegExp - #4892
    • Reformat Markdown files to comply with the spec - #4891
    • UnnecessaryInnerClass: fix false negative with this references - #4884
    • UselessCallOnNotNull: fix false positive for unresolved types - #4880
    • Update MagicNumber rule to exclude .kts files - #4877
    • CanBeNonNullable: fix false positives for parameterized types - #4870
    • UnnecessaryInnerClass: fix false positives labeled expression to outer class - #4865
    • UnnecessaryInnerClass: add test for safe qualified expressions - #4864
    • Fix a confusing Regex in the Compose webpage - #4852
    • Fix edit URLs for the website - #4850
    • detektGenerateConfig adds the configuration of plugins - #4844
    • Update dependency prism-react-renderer to v1.3.3 - #4833
    • Search in all versions.properties, not just the first one #4830 - #4831
    • Improve exception message - #4823
    • Fix ValShouldBeVar false positive inside unknown type - #4820
    • Add a recent conference talk link - #4819
    • False positive for unused imports #4815 - #4818
    • Revert "Display dynamic --jvm-target values when using --help flag (#4694)" - #4816
    • UnnecessaryAbstractClass: report only the class name - #4808
    • Fix wrong replacement suggestion for UnnecessaryFilter - #4807
    • UseOrEmpty: fix false positive for indexing operator calls with type parameters - #4804
    • ExplicitCollectionElementAccessMethod: fix false positive for get operators with type parameters - #4803
    • Add tests for #4786 - #4801
    • Add documentation link for rules in html report - #4799
    • Improve rule documentaion and smell message of NamedArguments - #4796
    • Improve issue description and smell message of DestructuringDeclarationWithTooManyEntries - #4795
    • NestedScopeFunctions - Add rule for nested scope functions - #4788
    • Partially drop redundant usage of "dry run" in Gradle plugin tests - #4776
    • Allow additionalJavaSourceRootPaths to be defined on @KotlinCoreEnvironmentTest - #4771
    • Report KDoc comments that refer to non-public properties of a class - #4768
    • Self-inspect the detekt-gradle-plugin - #4765
    • Pass args to DetektInvoker as List<String> - #4762
    • Cleanup Gradle Plugin Publications - #4752
    • Break a dependency between detekt-gradle-plugin and detekt-utils - #4748
    • Remove suspend lambda rule with CoroutineScope receiver due to not de… - #4747
    • VarCouldBeVal: Add configuration flag ignoreLateinitVar - #4745
    • UnnecessaryInnerClass: fix false positive with references to function type variables - #4738
    • Fix false positive on VarCouldBeVal in generic classes - #4733
    • OutdatedDocumentation: fix false positive with no primary constructor - #4728
    • Android Gradle: add javac intermediates to classpath - #4723
    • OptionalWhenBraces: fix false negative when the single statement has comments inside - #4722
    • Document pre-commit hook for staged files - #4711
    • Enable rules by default for 1.21 - #4643

    Dependency Updates

    • Update dependency org.jetbrains.kotlinx:kotlinx-coroutines-core to v1.6.2 - #4868
    • Update dependency com.android.tools.build:gradle to v7.2.1 - #4861
    • Update plugin binaryCompatibilityValidator to v0.10.0 - #4837
    • Update dependency io.mockk:mockk to v1.12.4 - #4829
    • Update dependency com.android.tools.build:gradle to v7.2.0 - #4824
    • Add dependency-analysis plugin and implement some recommendations - #4798
    • Add dependency on slf4j-nop to silence warning - #4775
    • Update plugin dokka to v1.6.21 - #4770
    • Update org.jetbrains.kotlin to v1.6.21 - #4737
    • Update dependency com.github.breadmoirai:github-release to v2.3.7 - #4734
    • Update plugin binaryCompatibilityValidator to v0.9.0 - #4729

    Housekeeping & Refactorings

    • Declare nested test classes as non-static - #4894
    • Remove deprecated usages in gradle-plugin test - #4889
    • Remove reference to contributor list - #4871
    • Add missing image - #4834
    • Upgrade to GE enterprise 3.10 - #4802
    • Fix broken snapshot publishing - #4783
    • Remove pending Gradle version milestones from comments - #4777
    • Add more tests for Annotation Suppressor - #4774
    • fix: add test case that fails if environment is not properly set up - #4769
    • Disable UnusedImports for the Detekt project - #4741
    • Remove Unnecesary @Nested - #4740
    • Update the argsfile to unblock runWithArgsFile failing locally - #4718

    See all issues at: 1.21.0

    Source code(tar.gz)
    Source code(zip)
    detekt-cli-1.21.0-RC1-all.jar(60.88 MB)
    detekt-cli-1.21.0-RC1.zip(55.67 MB)
    detekt-formatting-1.21.0-RC1.jar(909.94 KB)
  • v1.20.0(Apr 15, 2022)

    We're extremely excited to share with you all the next upcoming stable release of Detekt: 1.20.0 🎉 This release is coming with 16 new rules, new API and functionalities and several stability improvements.

    First, much thanks to our sponsors ❤️ as we were able to buy a domain and move our website to https://detekt.dev/.

    As for the feature shipped, we work a lot on the Reporting side: we added a new type of reporting, improved the styling of the existing one and generally reduced the unnecessary warnings of run with type resolution.

    For rules like ForbiddenMethod where you can configure a signature of a method you want to use in your rule, we added a new syntax that allows to reference generic methods & extension functions.

    We update a lot of the libraries we depend on bringing Detekt up to the ecosystem: KtLint 0.45.2, Kotlin 1.6.20 and Gradle 7.4.2 to name a few.

    Finally, we also migrated all of our tests from Spek to JUnit. This was a huge effort that will hopefully make easier for contributors to be involved with Detekt.

    As always, we want to take the opportunity to thank our contributors for testing, bug reporting and helping us release this new version of Detekt. You're more than welcome to join our community on the #detekt channel on KotlinLang's Slack (you can get an invite here).

    Notable Changes

    • With this Detekt versions, rule authors can define the default configuration for their custom rules. This default configuration will be merged together with the user configuration and can be overridden by the user if they wish. More on this here #4315. The formatting ruleset provided by Detekt is updated to use this new mechanism - #4352
    • We've added 16 new rules:
      • UnnecessaryInnerClass - #4394
      • CanBeNonNullableProperty - #4379
      • NullCheckOnMutableProperty - #4353
      • SuspendFunWithCoroutineScopeReceiver - #4616
      • ElseCaseInsteadOfExhaustiveWhen - #4632
      • TrailingComma - From KtLint - #4227
      • UnnecessaryParenthesesBeforeTrailingLambda - From KtLint - #4630
      • BlockCommentInitialStarAlignment - From KtLint - #4645
      • CommentWrapping - From KtLint - #4645
      • DiscouragedCommentLocation - From KtLint - #4645
      • FunKeywordSpacing - From KtLint - #4645
      • FunctionTypeReferenceSpacing - From KtLint - #4645
      • KdocWrapping - From KtLint - #4645
      • ModifierListSpacing - From KtLint - #4645
      • TypeArgumentListSpacing - From KtLint - #4645
      • Wrapping - From KtLint - #4645
    • We've made several improvements to the console reporting:
      • The HTML report has now a better CSS styling - #4447
      • The default reporting format is now LiteFindingsReport (which is more compact reporting and similar to other tools in the ecosystem. You can see an example here) - #4449.
      • We've added issue details to findings on FindingsReport and FileBasedFindingsReporter - #4464
      • We suppressed several warnings reported when running with type resolution - #4423
    • We fixed a regression introduced in 1.19.0 for users using ignoreAnnotated running without type resolution - #4570
    • For rules like ForbiddenMethod where you can specify a method name in the config file, now we added support for:
      • Matching functions with generics - #4460
      • Matching extension functions - #4459
    • We've fixed a security vulnerability related to XML parsing - #4499
    • We've changed the behavior of the baseline task. Now the baseline is always update, even if you fixed all the issues in your codebase - #4445
    • We now enable the naming ruleset by default also on tests. Previously they were excluded - #4438
    • This version of Detekt is built with Gradle v7.4.2, AGP 7.1.3 and Kotlin 1.6.20 (see #4530 #4573 #4133 #4277 #4665)
    • This version of Detekt is wrapping KtLint version 0.45.2 (see #4227 #4630 #4645 #4690)
    • For contributors: we migrated all our tests from Spek to JUnit due to better support and tooling #4670.

    Changelog

    • Display dynamic --jvm-target values when using --help flag - #4694
    • CanBeNonNullable shouldn't consider abstract properties - #4686
    • NonBooleanPropertyPrefixedWithIs: Allow boolean function reference - #4684
    • [VarCouldBeVal] fix overrides false positives - #4664
    • Add ignoreOverridden support for BooleanPropertyNaming rule - #4654
    • Fix regression generating configuration - #4646
    • Fix concurrency issue when creating PomModel (#4609) - #4631
    • UnnecessaryAbstractClass: fix false positive when the abstract class has properties in the primary constructor - #4628
    • Properly set toolVersion on DetektExtension - #4623
    • NamedArguments: Ignore when argument values are the same as the parameter name - #4613
    • Parallel invocation of AnalysisFacade fails spuriously in 1.20.0-RC1 - #4609
    • NoSuchElementException after updating to 1.20.0-RC1 - #4604
    • Better error classification in Gradle Enterprise. - #4586
    • Fix for missing /kotlin folder when running on Android projects - #4554
    • Deprecate continuationIndentSize from the Indentation rule - #4551
    • Fix performance issue for regexp in Reporting.kt - #4550
    • Revert "trim values when parsing the baseline (#4335)" - #4548
    • Fix AutoCorrection crashing with Missing extension point - #4545
    • Make DoubleMutabilityForCollection configurable and set a DoubleMutability alias - #4541
    • Fix AnnotationExcluder - #4518
    • Fix false positive of UnnecessaryInnerClass - #4509
    • [MaxLineLength] Fix signature in for blank characters in the Baseline - #4504
    • Fix overridden function reporting for CanBeNonNullable rule - #4497
    • Set the name of functions and paramenters between ` to improve the readability - #4488
    • update InvalidPackageDeclaration to report if rootPackage is not present - #4484
    • [VarCouldBeVal] Override vars will not be flagged if bindingContext is not set - #4477
    • Document the overlapping rules from formatting - #4473
    • Match functions signatures with lambdas on it - #4458
    • Add option for OutdatedDocumentation to allow param in constructor pr… - #4453
    • Ignore private operators when we don't have ContextBingding in UnusedPrivateMember - #4441
    • Add documentation for Suppressors - #4440
    • [FunctionNaming] Don't allow the usage of ` in function names - #4439
    • Add list of functions to skip in IgnoredReturnValue rule - #4434
    • Extend CanBeNonNullable rule to check function params - #4431
    • Extend VarCouldBeVal to include analysis of file- and class-level properties - #4424
    • Formulate rule/sample-extensions descriptions consistently - #4412
    • Fix false-positive on ExplicitCollectionElementAccessMethod - #4400
    • Fixes false negatives in UnnecessaryAbstractClass - #4399
    • Add first draft of a rule description style guide - #4386
    • Forbid usage of java.lang.ClassLoader.getResourceAsStream - #4381
    • Update Sponsor button to Detekt's one - #4378
    • [OptionalUnit] Allow a function to declare a Unit return type when it uses a generic function initializer - #4371
    • Completely-empty abstract classes will now be flagged by UnnecessaryAbstractClass - #4370
    • Fix false positive in RethrowCaughtException for try with more than one catch (#4367) - #4369
    • Testing and rule improvement for EmptyElseBlock - #4349
    • UnusedPrivateMember should not report external classes/interfaces - #4347
    • [UseDataClass] Do not report on inner classes - #4344
    • Support jvmTarget 17 - #4287
    • UnderscoresInNumericLiterals: Allow numbers with non standard groupings - #4280
    • Introduce DefaultValue type - #3928

    Dependency Updates

    • Update plugin dokka to v1.6.20 - #4717
    • Update dependency com.android.tools.build:gradle to v7.1.3 - #4695
    • JaCoCo 0.8.8 - #4680
    • Update dependency org.jetbrains.kotlinx:kotlinx-coroutines-core to v1.6.1 - #4673
    • Update dependency gradle to v7.4.2 - #4658
    • Update dependency org.jetbrains.kotlinx:kotlinx-html-jvm to v0.7.5 - #4657
    • Update dependency gradle to v7.4.1 - #4622
    • Update dependency com.android.tools.build:gradle to v7.1.2 - #4594
    • Update dependency com.android.tools.build:gradle to v7.1.1 - #4561
    • Update plugin pluginPublishing to v0.20.0 - #4502
    • Update JamesIves/github-pages-deploy-action action to v4.2.1 - #4475
    • Update JamesIves/github-pages-deploy-action action to v4.1.9 - #4455
    • Update plugin gradleVersions to v0.41.0 - #4454
    • Revert "Update plugin pluginPublishing to v0.19.0 (#4429)" - #4452
    • Update plugin pluginPublishing to v0.19.0 - #4429
    • Update dependency io.mockk:mockk to v1.12.2 - #4427
    • Shadow 7.1.2 - #4422
    • Update plugin dokka to v1.6.10 - autoclosed - #4407
    • Update dependency org.jetbrains.dokka:jekyll-plugin to v1.6.10 - #4406
    • Update dependency org.jetbrains.kotlinx:kotlinx-coroutines-core to v1.6.0 - #4393
    • Update dependency gradle to v7.3.3 - #4392
    • Update dependency org.yaml:snakeyaml to v1.30 - #4375
    • Update dependency gradle to v7.3.2 - #4374
    • Update plugin shadow to v7.1.1 - #4373
    • Update dependency gradle to v7.3.1 - #4350
    • Update plugin dokka to v1.6.0 - #4328

    Housekeeping & Refactorings

    • Add missing Test annotations - #4699
    • Add failure message assertions to Gradle's "expect failure" tests - #4693
    • Drop (most) Groovy DSL tests - #4687
    • Check detekt-gradle-plugin functionalTest source when running detekt task - #4681
    • Fix typo in AvoidReferentialEquality rule description - #4644
    • Housekeep Gradle scripts - #4589
    • Refactor config printer to improve testability - #4580
    • avoid usage of java stream for parameterized tests - #4579
    • split rule documentation printer to improve testability - #4578
    • Make VERSION_CATALOGS stable - #4577
    • Enable Gradle's configuration cache by default - #4576
    • Migrate detekt-rules-performance tests to JUnit - #4569
    • Migrate detekt-rules-complexity tests to JUnit - #4566
    • Drop Groovy DSL testing in DetektTaskDslSpec - #4563
    • Reuse setReportOutputConventions - #4546
    • Code cleanups - #4542
    • Fix MaxLineLength violation on detekt main inside IgnoredReturnValue rule - #4539
    • Use Java 17 for all CI jobs - #4526
    • Migrate tests in detekt-rules-errorprone to junit - #4523
    • Drop unused dependencies - #4506
    • Update JUnit dependencies - #4505
    • Fixes test for LiteFindingsReport - #4479
    • Remove outdated detekt suppression - #4468
    • Add test cases to RedundantSuspendModifier rule - #4430
    • Refactor MultilineLambdaItParameter rule - #4428
    • Formulate rule/naming descriptions consistently - #4419
    • Formulate rule/bugs descriptions consistently - #4418
    • Formulate rule/complexity descriptions consistently - #4417
    • Formulate rule/documentation descriptions consistently - #4416
    • Formulate rule/coroutines descriptions consistently - #4415
    • Formulate rule/style descriptions consistently - #4414
    • Formulate rule/exceptions descriptions consistently - #4413
    • Formulate rule/performance descriptions consistently - #4411
    • Make MultiRuleCollector.kt consistent with the DoubleMutabilityForCollection rule - #4405
    • Add test for nested SwallowedException - #4404
    • Disable CI for Windows & JDK8 - #4403
    • Improve test description in ForEachOnRangeSpec.kt - #4402
    • Don't define classes on default package - #4401
    • Config file in directory test - #4398
    • Remove unnecessary map lambda in test code - #4397
    • Improve AnnotationExcluder tests - #4368
    • Enable UseAnyOrNoneInsteadOfFind - #4362
    • Enable ForbiddenMethodCall - #4334

    See all issues at: 1.20.0

    Source code(tar.gz)
    Source code(zip)
    detekt-cli-1.20.0-all.jar(60.84 MB)
    detekt-cli-1.20.0.zip(55.64 MB)
    detekt-formatting-1.20.0.jar(907.38 KB)
  • v1.20.0-RC2(Apr 2, 2022)

    v1.20.0-RC2 - 2022-03-31

    Notable Changes

    • Thanks to our sponsors ❤️, we were able to buy a domain and move our website to https://detekt.dev/.
    • With this Detekt versions, rule authors can define the default configuration for their custom rules. This default configuration will be merged together with the user configuration and can be overridden by the user if they wish. More on this here #4315. The formatting ruleset provided by Detekt is updated to use this new mechanism - #4352
    • We've added 16 new rules:
      • UnnecessaryInnerClass - #4394
      • CanBeNonNullableProperty - #4379
      • NullCheckOnMutableProperty - #4353
      • SuspendFunWithCoroutineScopeReceiver - #4616
      • ElseCaseInsteadOfExhaustiveWhen - #4632
      • TrailingComma - From KtLint - #4227
      • UnnecessaryParenthesesBeforeTrailingLambda - From KtLint - #4630
      • BlockCommentInitialStarAlignment - From KtLint - #4645
      • CommentWrapping - From KtLint - #4645
      • DiscouragedCommentLocation - From KtLint - #4645
      • FunKeywordSpacing - From KtLint - #4645
      • FunctionTypeReferenceSpacing - From KtLint - #4645
      • KdocWrapping - From KtLint - #4645
      • ModifierListSpacing - From KtLint - #4645
      • TypeArgumentListSpacing - From KtLint - #4645
      • Wrapping - From KtLint - #4645
    • We've made several improvements to the console reporting:
      • The HTML report has now a better CSS styling - #4447
      • The default reporting format is now LiteFindingsReport (which is more compact reporting and similar to other tools in the ecosystem. You can see an example here) - #4449.
      • We've added issue details to findings on FindingsReport and FileBasedFindingsReporter - #4464
      • We suppressed several warnings reported when running with type resolution - #4423
    • We fixed a regression introduced in 1.19.0 for users using ignoreAnnotated running without type resolution - #4570
    • For rules like ForbiddenMethod where you can specify a method name in the config file, now we added support for:
      • Matching functions with generics - #4460
      • Matching extension functions - #4459
    • We've fixed a security vulnerability related to XML parsing - #4499
    • We've changed the behavior of the baseline task. Now the baseline is always update, even if you fixed all the issues in your codebase - #4445
    • We now enable the naming ruleset by default also on tests. Previously they were excluded - #4438
    • This version of Detekt is built with Gradle v7.4.1, AGP 7.1.1 and Kotlin 1.6.10 (see #4530 #4573 #4133 #4277)
    • This version of Detekt is wrapping KtLint version 0.45.1 (see #4227 - #4630 - #4645)
    • For contributors: we migrated most of our tests from Spek to JUnit due to better support and tooling.

    Changelog

    • Add ignoreOverridden support for BooleanPropertyNaming rule - #4654
    • Fix regression generating configuration - #4646
    • Fix concurrency issue when creating PomModel (#4609) - #4631
    • UnnecessaryAbstractClass: fix false positive when the abstract class has properties in the primary constructor - #4628
    • Properly set toolVersion on DetektExtension - #4623
    • NamedArguments: Ignore when argument values are the same as the parameter name - #4613
    • Parallel invocation of AnalysisFacade fails spuriously in 1.20.0-RC1 - #4609
    • NoSuchElementException after updating to 1.20.0-RC1 - #4604
    • Better error classification in Gradle Enterprise. - #4586
    • Fix for missing /kotlin folder when running on Android projects - #4554
    • Deprecate continuationIndentSize from the Indentation rule - #4551
    • Fix performance issue for regexp in Reporting.kt - #4550
    • Revert "trim values when parsing the baseline (#4335)" - #4548
    • Fix AutoCorrection crashing with Missing extension point - #4545
    • Make DoubleMutabilityForCollection configurable and set a DoubleMutability alias - #4541
    • Fix AnnotationExcluder - #4518
    • Fix false positive of UnnecessaryInnerClass - #4509
    • [MaxLineLength] Fix signature in for blank characters in the Baseline - #4504
    • Fix overridden function reporting for CanBeNonNullable rule - #4497
    • Set the name of functions and paramenters between ` to improve the readability - #4488
    • update InvalidPackageDeclaration to report if rootPackage is not present - #4484
    • [VarCouldBeVal] Override vars will not be flagged if bindingContext is not set - #4477
    • Document the overlapping rules from formatting - #4473
    • Match functions signatures with lambdas on it - #4458
    • Add option for OutdatedDocumentation to allow param in constructor pr… - #4453
    • Ignore private operators when we don't have ContextBingding in UnusedPrivateMember - #4441
    • Add documentation for Suppressors - #4440
    • [FunctionNaming] Don't allow the usage of ` in function names - #4439
    • Add list of functions to skip in IgnoredReturnValue rule - #4434
    • Extend CanBeNonNullable rule to check function params - #4431
    • Extend VarCouldBeVal to include analysis of file- and class-level properties - #4424
    • Formulate rule/sample-extensions descriptions consistently - #4412
    • Fix false-positive on ExplicitCollectionElementAccessMethod - #4400
    • Fixes false negatives in UnnecessaryAbstractClass - #4399
    • Add first draft of a rule description style guide - #4386
    • Forbid usage of java.lang.ClassLoader.getResourceAsStream - #4381
    • Update Sponsor button to Detekt's one - #4378
    • [OptionalUnit] Allow a function to declare a Unit return type when it uses a generic function initializer - #4371
    • Completely-empty abstract classes will now be flagged by UnnecessaryAbstractClass - #4370
    • Fix false positive in RethrowCaughtException for try with more than one catch (#4367) - #4369
    • Testing and rule improvement for EmptyElseBlock - #4349
    • UnusedPrivateMember should not report external classes/interfaces - #4347
    • [UseDataClass] Do not report on inner classes - #4344
    • Support jvmTarget 17 - #4287
    • UnderscoresInNumericLiterals: Allow numbers with non standard groupings - #4280
    • Introduce DefaultValue type - #3928

    Dependency Updates

    • Update dependency gradle to v7.4.1 - #4622
    • Update dependency com.android.tools.build:gradle to v7.1.2 - #4594
    • Update dependency com.android.tools.build:gradle to v7.1.1 - #4561
    • Update plugin pluginPublishing to v0.20.0 - #4502
    • Update JamesIves/github-pages-deploy-action action to v4.2.1 - #4475
    • Update JamesIves/github-pages-deploy-action action to v4.1.9 - #4455
    • Update plugin gradleVersions to v0.41.0 - #4454
    • Revert "Update plugin pluginPublishing to v0.19.0 (#4429)" - #4452
    • Update plugin pluginPublishing to v0.19.0 - #4429
    • Update dependency io.mockk:mockk to v1.12.2 - #4427
    • Shadow 7.1.2 - #4422
    • Update plugin dokka to v1.6.10 - autoclosed - #4407
    • Update dependency org.jetbrains.dokka:jekyll-plugin to v1.6.10 - #4406
    • Update dependency org.jetbrains.kotlinx:kotlinx-coroutines-core to v1.6.0 - #4393
    • Update dependency gradle to v7.3.3 - #4392
    • Update dependency org.yaml:snakeyaml to v1.30 - #4375
    • Update dependency gradle to v7.3.2 - #4374
    • Update plugin shadow to v7.1.1 - #4373
    • Update dependency gradle to v7.3.1 - #4350
    • Update plugin dokka to v1.6.0 - #4328

    Housekeeping & Refactorings

    • Fix typo in AvoidReferentialEquality rule description - #4644
    • Housekeep Gradle scripts - #4589
    • Refactor config printer to improve testability - #4580
    • avoid usage of java stream for parameterized tests - #4579
    • split rule documentation printer to improve testability - #4578
    • Make VERSION_CATALOGS stable - #4577
    • Enable Gradle's configuration cache by default - #4576
    • Migrate detekt-rules-performance tests to JUnit - #4569
    • Migrate detekt-rules-complexity tests to JUnit - #4566
    • Drop Groovy DSL testing in DetektTaskDslSpec - #4563
    • Reuse setReportOutputConventions - #4546
    • Code cleanups - #4542
    • Fix MaxLineLength violation on detekt main inside IgnoredReturnValue rule - #4539
    • Use Java 17 for all CI jobs - #4526
    • Migrate tests in detekt-rules-errorprone to junit - #4523
    • Drop unused dependencies - #4506
    • Update JUnit dependencies - #4505
    • Fixes test for LiteFindingsReport - #4479
    • Remove outdated detekt suppression - #4468
    • Add test cases to RedundantSuspendModifier rule - #4430
    • Refactor MultilineLambdaItParameter rule - #4428
    • Formulate rule/naming descriptions consistently - #4419
    • Formulate rule/bugs descriptions consistently - #4418
    • Formulate rule/complexity descriptions consistently - #4417
    • Formulate rule/documentation descriptions consistently - #4416
    • Formulate rule/coroutines descriptions consistently - #4415
    • Formulate rule/style descriptions consistently - #4414
    • Formulate rule/exceptions descriptions consistently - #4413
    • Formulate rule/performance descriptions consistently - #4411
    • Make MultiRuleCollector.kt consistent with the DoubleMutabilityForCollection rule - #4405
    • Add test for nested SwallowedException - #4404
    • Disable CI for Windows & JDK8 - #4403
    • Improve test description in ForEachOnRangeSpec.kt - #4402
    • Don't define classes on default package - #4401
    • Config file in directory test - #4398
    • Remove unnecessary map lambda in test code - #4397
    • Improve AnnotationExcluder tests - #4368
    • Enable UseAnyOrNoneInsteadOfFind - #4362
    • Enable ForbiddenMethodCall - #4334

    See all issues at: 1.20.0

    Source code(tar.gz)
    Source code(zip)
    detekt-cli-1.20.0-RC2-all.jar(58.92 MB)
    detekt-cli-1.20.0-RC2.zip(53.87 MB)
    detekt-formatting-1.20.0-RC2.jar(899.87 KB)
  • v1.20.0-RC1(Feb 28, 2022)

    v1.20.0-RC1 - 2022-02-26

    Notable Changes

    • Thanks to our sponsors ❤️, we were able to buy a domain and move our website to https://detekt.dev/.
    • With this Detekt versions, rule authors can define the default configuration for their custom rules. This default configuration will be merged together with the user configuration and can be overridden by the user if they wish. More on this here #4315. The formatting ruleset provided by Detekt is updated to use this new mechanism - #4352
    • We've added 4 new rules:
      • UnnecessaryInnerClass - #4394
      • CanBeNonNullableProperty - #4379
      • TrailingComma - #4227
      • NullCheckOnMutableProperty - #4353
    • We've made several improvements to the console reporting:
      • The HTML report has now a better CSS styling - #4447
      • The default reporting format is now LiteFindingsReport (which is more compact reporting and similar to other tools in the ecosystem. You can see an example here) - #4449.
      • We've added issue details to findings on FindingsReport and FileBasedFindingsReporter - #4464
      • We suppressed several warnings reported when running with type resolution - #4423
    • We fixed a regression introduced in 1.19.0 for users using ignoreAnnotated running without type resolution - #4570
    • We've fixed a security vulnerability related to XML parsing - #4499
    • We've changed the behavior of the baseline task. Now the baseline is always update, even if you fixed all the issues in your codebase - #4445
    • We now enable the naming ruleset by default also on tests. Previously they were excluded - #4438
    • This version of Detekt is built with Gradle v7.4, AGP 7.1.1 and Kotlin 1.6.10 (see #4530 #4573 #4133 #4277)
    • This version of Detekt is wrapping KtLint version 0.43.2 (see #4227)
    • For contributors: we migrated most of our tests from Spek to JUnit due to better support and tooling.

    Changelog

    • Better error classification in Gradle Enterprise. - #4586
    • Fix for missing /kotlin folder when running on Android projects - #4554
    • Deprecate continuationIndentSize from the Indentation rule - #4551
    • Fix performance issue for regexp in Reporting.kt - #4550
    • Revert "trim values when parsing the baseline (#4335)" - #4548
    • Fix AutoCorrection crashing with Missing extension point - #4545
    • Make DoubleMutabilityForCollection configurable and set a DoubleMutability alias - #4541
    • Fix AnnotationExcluder - #4518
    • Fix false positive of UnnecessaryInnerClass - #4509
    • [MaxLineLength] Fix signature in for blank characters in the Baseline - #4504
    • Fix overridden function reporting for CanBeNonNullable rule - #4497
    • Set the name of functions and paramenters between ` to improve the readability - #4488
    • update InvalidPackageDeclaration to report if rootPackage is not present - #4484
    • [VarCouldBeVal] Override vars will not be flagged if bindingContext is not set - #4477
    • Document the overlapping rules from formatting - #4473
    • Match functions signatures with lambdas on it - #4458
    • Add option for OutdatedDocumentation to allow param in constructor pr… - #4453
    • Ignore private operators when we don't have ContextBingding in UnusedPrivateMember - #4441
    • Add documentation for Suppressors - #4440
    • [FunctionNaming] Don't allow the usage of ` in function names - #4439
    • Add list of functions to skip in IgnoredReturnValue rule - #4434
    • Extend CanBeNonNullable rule to check function params - #4431
    • Extend VarCouldBeVal to include analysis of file- and class-level properties - #4424
    • Formulate rule/sample-extensions descriptions consistently - #4412
    • Fix false-positive on ExplicitCollectionElementAccessMethod - #4400
    • Fixes false negatives in UnnecessaryAbstractClass - #4399
    • Add first draft of a rule description style guide - #4386
    • Forbid usage of java.lang.ClassLoader.getResourceAsStream - #4381
    • Update Sponsor button to Detekt's one - #4378
    • [OptionalUnit] Allow a function to declare a Unit return type when it uses a generic function initializer - #4371
    • Completely-empty abstract classes will now be flagged by UnnecessaryAbstractClass - #4370
    • Fix false positive in RethrowCaughtException for try with more than one catch (#4367) - #4369
    • Testing and rule improvement for EmptyElseBlock - #4349
    • UnusedPrivateMember should not report external classes/interfaces - #4347
    • [UseDataClass] Do not report on inner classes - #4344
    • Support jvmTarget 17 - #4287
    • UnderscoresInNumericLiterals: Allow numbers with non standard groupings - #4280
    • Introduce DefaultValue type - #3928

    Dependency Updates

    • Update dependency com.android.tools.build:gradle to v7.1.2 - #4594
    • Update dependency com.android.tools.build:gradle to v7.1.1 - #4561
    • Update plugin pluginPublishing to v0.20.0 - #4502
    • Update JamesIves/github-pages-deploy-action action to v4.2.1 - #4475
    • Update JamesIves/github-pages-deploy-action action to v4.1.9 - #4455
    • Update plugin gradleVersions to v0.41.0 - #4454
    • Revert "Update plugin pluginPublishing to v0.19.0 (#4429)" - #4452
    • Update plugin pluginPublishing to v0.19.0 - #4429
    • Update dependency io.mockk:mockk to v1.12.2 - #4427
    • Shadow 7.1.2 - #4422
    • Update plugin dokka to v1.6.10 - autoclosed - #4407
    • Update dependency org.jetbrains.dokka:jekyll-plugin to v1.6.10 - #4406
    • Update dependency org.jetbrains.kotlinx:kotlinx-coroutines-core to v1.6.0 - #4393
    • Update dependency gradle to v7.3.3 - #4392
    • Update dependency org.yaml:snakeyaml to v1.30 - #4375
    • Update dependency gradle to v7.3.2 - #4374
    • Update plugin shadow to v7.1.1 - #4373
    • Update dependency gradle to v7.3.1 - #4350
    • Update plugin dokka to v1.6.0 - #4328

    Housekeeping & Refactorings

    • Housekeep Gradle scripts - #4589
    • Refactor config printer to improve testability - #4580
    • avoid usage of java stream for parameterized tests - #4579
    • split rule documentation printer to improve testability - #4578
    • Make VERSION_CATALOGS stable - #4577
    • Enable Gradle's configuration cache by default - #4576
    • Migrate detekt-rules-performance tests to JUnit - #4569
    • Migrate detekt-rules-complexity tests to JUnit - #4566
    • Drop Groovy DSL testing in DetektTaskDslSpec - #4563
    • Reuse setReportOutputConventions - #4546
    • Code cleanups - #4542
    • Fix MaxLineLength violation on detekt main inside IgnoredReturnValue rule - #4539
    • Use Java 17 for all CI jobs - #4526
    • Migrate tests in detekt-rules-errorprone to junit - #4523
    • Drop unused dependencies - #4506
    • Update JUnit dependencies - #4505
    • Fixes test for LiteFindingsReport - #4479
    • Remove outdated detekt suppression - #4468
    • Add test cases to RedundantSuspendModifier rule - #4430
    • Refactor MultilineLambdaItParameter rule - #4428
    • Formulate rule/naming descriptions consistently - #4419
    • Formulate rule/bugs descriptions consistently - #4418
    • Formulate rule/complexity descriptions consistently - #4417
    • Formulate rule/documentation descriptions consistently - #4416
    • Formulate rule/coroutines descriptions consistently - #4415
    • Formulate rule/style descriptions consistently - #4414
    • Formulate rule/exceptions descriptions consistently - #4413
    • Formulate rule/performance descriptions consistently - #4411
    • Make MultiRuleCollector.kt consistent with the DoubleMutabilityForCollection rule - #4405
    • Add test for nested SwallowedException - #4404
    • Disable CI for Windows & JDK8 - #4403
    • Improve test description in ForEachOnRangeSpec.kt - #4402
    • Don't define classes on default package - #4401
    • Config file in directory test - #4398
    • Remove unnecessary map lambda in test code - #4397
    • Improve AnnotationExcluder tests - #4368
    • Enable UseAnyOrNoneInsteadOfFind - #4362
    • Enable ForbiddenMethodCall - #4334

    See all issues at: 1.20.0

    Source code(tar.gz)
    Source code(zip)
    detekt-cli-1.20.0-RC1-all.jar(58.91 MB)
    detekt-cli-1.20.0-RC1.zip(53.86 MB)
    detekt-formatting-1.20.0-RC1.jar(638.45 KB)
  • v1.19.0(Nov 30, 2021)

    Please welcome the next upcoming stable release of Detekt: 1.19.0 🎉 This release is coming with a lot of new features, new rules, evolution in the API and stability improvements.

    Specifically, we've shipped some features that will allow you to better adapt detekt to run on codebases that are using JetPack compose with features such as ignoreAnnotated and ignoreFunction.

    As always, we want to take the opportunity to thank our contributors for testing, bug reporting and helping us release this new version of Detekt. You're more than welcome to join our community on the #detekt channel on KotlinLang's Slack (you can get an invite here).

    Notable Changes

    • We now offer an ignoreAnnotated configuration key that you can use on all your rules to suppress findings if inside an annotated block (e.g. @Composable) - #4102 and #4241
    • Similarly, we now offer also an ignoreFunction configuration key that you can use to suppress findings if inside a function with a given name - #4148
    • Report configuration is changing in the Gradle plugin. The reports extension on the detekt extension has been deprecated. See the Migration section below for steps to migrate to the new recommended configuration - #3687
    • The ExplicitCollectionElementAccessMethod rule is now a type-resolution only rule - #4201
    • The InvalidPackageDeclaration rule has been split to create the MissingPackageDeclaration rule - #4149
    • The ForbiddenComment rule now offers a customMessage configuration key - #4126
    • We bumped ktlint and updated the default enabled rules to mirror what ktlint is doing - #4179
    • Added a new LambdaParameterNaming rule, to enforce a naming convention of parameter inside lambdas - #4147
    • Added a new InjectDispatcher rule, to check if dispatchers are injectable - #4222
    • Added a new ConsoleReport format - #4027
    • Gradle: We added the --auto-correct cmdline option to gradle tasks - #4202
    • Gradle: We removed the afterEvaluate wrapper from the Android and KMM plugin - #4159 and #4271
    • We now test against Java 17 and stopped testing against Java 16 - #4136
    • Remove library specific configurations like Jetpack Compose and Dagger from the default config - #4101
    • Remove detekt-bom module - #4043
    • Use reference in fallback property delegate - #3982

    Migration

    Configuring reports in the Gradle plugin should be done at the task level instead of at the extension (or global) level. The previous recommendation resulted in the report output for multiple tasks overwriting each other when multiple detekt tasks were executed in the same Gradle run.

    Before this release the recommended way to configure reports was using the detekt extension:

    detekt {
        reports {
            xml {
                enabled = true
                destination = file("build/reports/detekt/detekt.xml")
            }
        }
    }
    

    This meant all detekt tasks would output the report to the same destination. From this detekt release you should enable and disable reports for all tasks using the withType Gradle method:

    // Kotlin DSL
    tasks.withType<Detekt>().configureEach {
        reports {
            xml.required.set(true)
        }
    }
    
    // Groovy DSL
    tasks.withType(Detekt).configureEach {
        reports {
            xml.required.set(true)
        }
    }
    

    To customize the report output location configure the task individually:

    tasks.detektMain {
        reports {
            xml {
                outputLocation.set(file("build/reports/detekt/customPath.xml"))
                required.set(true) // reports can also be enabled and disabled at the task level as needed
            }
        }
    }
    

    Changelog

    • trim values when parsing the baseline - #4335
    • Fix #4332 by widening the scope to all JDKs - #4333
    • Bugfix provided by #4225 needs wider scope - #4332
    • Avoid false positives in MemberNameEqualsClassName - #4329
    • Add two new config steps for Compose - #4322
    • Set DetektJvm task source with SourceDirectorySet instead of file list - #4151
    • Add documentation about how to configure Baseline task with type resolution - #4285
    • Remove kotlin-gradle-plugin-api from runtime classpath - #4275
    • Use appropriate annotations on source properties in Gradle tasks - #4264
    • Replace usage of deprecated ConfigureUtil - #4263
    • Fix test failure of ReportMergeSpec - #4262
    • Revert "Remove afterEvaluate wrapper (#4159)" - #4259
    • ExplicitCollectionElementAccessMethodSpec: does not report methods that is called on implicit receiver - #4256
    • UnusedPrivateMember: fix false positive with operator in - #4249
    • Introduce UseAnyOrNoneInsteadOfFind rule - #4247
    • OptionalWhenBraces: fix false negative for nested when - #4246
    • Handle MultiRules in Suppressors - #4239
    • Fix UselessCallOnNotNull rule - #4237
    • Make detekt a bit less noisy when mixing java and kotlin files - #4231
    • Workaround for JDK 8 instability when reading config - #4225
    • Define FunctionSignature - #4176
    • ForbiddenMethodCall: report overriding method calls - #4205
    • ObjectLiteralToLambda: fix false positive when using Java interfaces with default methods - #4203
    • Unit tests for TooGenericExceptionThrown - #4198
    • Display correct --jvm-target values when using --help flag - #4195
    • Improved MaximumLineLength documentation - #4188
    • Report NewLineAtEndOfFile source location at end of file - #4187
    • #4169 OutdatedDocumentation rule - #4185
    • Don't report on platform types in NullableToStringCall - #4180
    • Fix #4140: Allow Bazel based tests to run with string test input - #4170
    • Improve ForbiddenMethodCall documentation - #4166
    • Report SwallowedException on catchParameter - #4158
    • Enable binary compatibility validator for detekt-test and detekt-test-api - #4157
    • Fix issues with Elvis operator in UnconditionalJumpStatementInLoop - #4150
    • Improve documentation for naming rules - #4146
    • Disable UnsafeCallOnNullableType on tests - #4123
    • Remove annotations from LateinitUsage noncompliant block - #4100
    • UnnecessaryAbstractClass: false positive when the abstract class has internal/protected abstract members - #4099
    • Deprecate DefaultContext - #4098
    • Fix confusing message when breaking the MultilineLambdaItParameter rule - #4089
    • Remove deprecated KotlinExtension - #4063
    • Add an alias for FunctionMinLength/FunctionMaxLength rules to be more descriptive - #4050
    • fix report path, default path is reports/detekt/... - #4034
    • Fix TextLocation of Indentation rule - #4030
    • detekt-bom is going away after 1.18.0 - #3988
    • UnderscoresInNumericLiterals acceptableDecimalLength is off by one - #3972
    • Create rule set configurations in a safe way - #3964
    • Remove UnnecessarySafeCall safeguard against ErrorType - #3439

    Dependency Updates

    • Update dependency org.jetbrains.kotlinx:kotlinx-coroutines-core to v1.5.2 - #4302
    • Update dependency io.mockk:mockk to v1.12.1 - #4297
    • Update dependency com.android.tools.build:gradle to v4.2.2 - #4296
    • Gradle Publishing Plugin 0.17.0 - #4270
    • Shadow 7.1.0 - #4269
    • Dokka 1.5.31 - #4268
    • Binary Compatibility Validator 0.8.0 - #4267
    • Reflections 0.10.2 - #4266
    • Upgrade to Gradle 7.3 - #4254
    • Dokka 1.5.30 - #4114
    • Kotlin 1.5.31 - #4113
    • Update dependencies - #4065

    Housekeeping & Refactorings

    • Simplify YamlConfig - #4316
    • Move tests to the correct module - #4314
    • Don't hide null issues - #4313
    • Add functional test for type resolution for JVM - #4307
    • Minor typo fix and code refactoring - #4284
    • Improve Tests of UnnecesaryLet - #4282
    • Fix typo in UnnecessaryLet - #4281
    • Fix typo in Gradle lib definition - #4255
    • Rename DoubleMutabilityInCollectionSpec to DoubleMutabilityForCollectionSpec - #4251
    • Simplify conditional checks to improve coverage - #4221
    • Refactor NoTabs to remove DetektVisitor - #4220
    • Fix typos and grammar in rule descriptions - #4219
    • Use Kotlin's ArrayDeque implementation - #4218
    • Update Kotlin docs URL - #4217
    • Report UntilInsteadOfRangeTo for 'rangeTo' calls - #4212
    • Add tests for merging reports - #4199
    • Setup Gradle functional tests - #4074
    • GitHub Actions cache fixes - #3723
    • Simplify where casts used unnecessarily - #4213
    • Don't specify Gradle Enterprise Gradle Plugin version - #4210
    • Fix baserule import in tests - #4189
    • Run CLI sanity checks with Gradle - #4186
    • Use Codecov GitHub Action to upload coverage - #4184
    • Enable ParameterListWrapping rule on detekt codebase - #4178
    • Add test cases for MagicNumber - #4152
    • Fix FunctionParameterNamingSpec - #4145
    • Address feedback on #4139 - #4143
    • Don't skip tests that now pass - #4142
    • Fixes for Kotlin 1.6.0-M1 - #4139
    • Don't unnecessarily propogate opt-in requirement - #4116
    • Drop junit-platform-launcher dependency - #4115
    • Ensure detekt-tooling public API is stable - #4112
    • Fix globing typo - #4107
    • Rename and split ValidateConfig files - #4105
    • Dynamic deprecation - #4104
    • Fix indent issues with continuation indent - #4103
    • Refactor so detekt-gradle-plugin can be added as an included build - #4094
    • Migrate buildSrc to composite build - #4090
    • Fix broken applySelfAnalysisVersion task - #4082
    • Convert DetektJvmSpec to use ProjectBuilder - #4075
    • Upscale JVM settings - #4057
    • Gradle 7.2 - #4056
    • Verify at compile time that issue id matches rule name - #4047

    See all issues at: 1.19.0

    Source code(tar.gz)
    Source code(zip)
    detekt-cli-1.19.0-all.jar(55.49 MB)
    detekt-cli-1.19.0.zip(50.65 MB)
    detekt-formatting-1.19.0.jar(597.63 KB)
  • v1.19.0-RC2(Nov 18, 2021)

    v1.19.0-RC1 - 2021-11-18

    Notable Changes
    • We now offer an ignoreAnnotated configuration key that you can use on all your rules to suppress findings if inside an annotated block (e.g. @Composable) - #4102 and #4241
    • Report configuration is changing in the Gradle plugin. The reports extension on the detekt extension has been deprecated. See the Migration section below for steps to migrate to the new recommended configuration - #3687
    • The ExplicitCollectionElementAccessMethod rule is now a type-resolution only rule - #4201
    • The InvalidPackageDeclaration rule has been split to create the MissingPackageDeclaration rule - #4149
    • The ForbiddenComment rule now offers a customMessage configuration key - #4126
    • We bumped ktlint and updated the default enabled rules to mirror what ktlint is doing - #4179
    • Added a new LambdaParameterNaming rule, to enfornce a naming convention of paramter inside lambdas - #4147
    • Added a new InjectDispatcher rule, to check if dispatchers are injectable - #4222
    • Added a new ConsoleReport format - #4027
    • Gradle: We added the --auto-correct cmdline option to gradle tasks - #4202
    • Gradle: We removed the afterEvaluate wrapper from the Android and KMM plugin - #4159 and #4271
    • We now test against Java 17 and stopped testing against Java 16 - #4136
    • Remove library specific configurations like Jetpack Compose and Dagger from the default config - #4101
    • Remove detekt-bom module - #4043
    • Use reference in fallback property delegate - #3982
    Migration

    Configuring reports in the Gradle plugin should be done at the task level instead of at the extension (or global) level. The previous recommendation resulted in the report output for multiple tasks overwriting each other when multiple detekt tasks were executed in the same Gradle run.

    Before this release the recommended way to configure reports was using the detekt extension:

    detekt {
        reports {
            xml {
                enabled = true
                destination = file("build/reports/detekt/detekt.xml")
            }
        }
    }
    

    This meant all detekt tasks would output the report to the same destination. From this detekt release you should enable and disable reports for all tasks using the withType Gradle method:

    // Kotlin DSL
    tasks.withType<Detekt>().configureEach {
        reports {
            xml.required.set(true)
        }
    }
    
    // Groovy DSL
    tasks.withType(Detekt).configureEach {
        reports {
            xml.required.set(true)
        }
    }
    

    To customize the report output location configure the task individually:

    tasks.detektMain {
        reports {
            xml {
                outputLocation.set(file("build/reports/detekt/customPath.xml"))
                required.set(true) // reports can also be enabled and disabled at the task level as needed
            }
        }
    }
    
    Changelog
    • Add documentation about how to configure Baseline task with type resolution - #4285
    • Remove kotlin-gradle-plugin-api from runtime classpath - #4275
    • Use appropriate annotations on source properties in Gradle tasks - #4264
    • Replace usage of deprecated ConfigureUtil - #4263
    • Fix test failure of ReportMergeSpec - #4262
    • Revert "Remove afterEvaluate wrapper (#4159)" - #4259
    • ExplicitCollectionElementAccessMethodSpec: does not report methods that is called on implicit receiver - #4256
    • UnusedPrivateMember: fix false positive with operator in - #4249
    • Introduce UseAnyOrNoneInsteadOfFind rule - #4247
    • OptionalWhenBraces: fix false negative for nested when - #4246
    • Handle MultiRules in Suppressors - #4239
    • Fix UselessCallOnNotNull rule - #4237
    • Make detekt a bit less noisy when mixing java and kotlin files - #4231
    • Workaround for JDK 8 instability when reading config - #4225
    • Define FunctionSignature - #4176
    • ForbiddenMethodCall: report overriding method calls - #4205
    • ObjectLiteralToLambda: fix false positive when using Java interfaces with default methods - #4203
    • Unit tests for TooGenericExceptionThrown - #4198
    • Display correct --jvm-target values when using --help flag - #4195
    • Improved MaximumLineLength documentation - #4188
    • Report NewLineAtEndOfFile source location at end of file - #4187
    • #4169 OutdatedDocumentation rule - #4185
    • Don't report on platform types in NullableToStringCall - #4180
    • Fix #4140: Allow Bazel based tests to run with string test input - #4170
    • Improve ForbiddenMethodCall documentation - #4166
    • Report SwallowedException on catchParameter - #4158
    • Enable binary compatibility validator for detekt-test and detekt-test-api - #4157
    • Fix issues with Elvis operator in UnconditionalJumpStatementInLoop - #4150
    • Improve documentation for naming rules - #4146
    • Disable UnsafeCallOnNullableType on tests - #4123
    • Remove annotations from LateinitUsage noncompliant block - #4100
    • UnnecessaryAbstractClass: false positive when the abstract class has internal/protected abstract members - #4099
    • Deprecate DefaultContext - #4098
    • Fix confusing message when breaking the MultilineLambdaItParameter rule - #4089
    • Remove deprecated KotlinExtension - #4063
    • Add an alias for FunctionMinLength/FunctionMaxLength rules to be more descriptive - #4050
    • fix report path, default path is reports/detekt/... - #4034
    • Fix TextLocation of Indentation rule - #4030
    • detekt-bom is going away after 1.18.0 - #3988
    • UnderscoresInNumericLiterals acceptableDecimalLength is off by one - #3972
    • Create rule set configurations in a safe way - #3964
    • Remove UnnecessarySafeCall safeguard against ErrorType - #3439
    Dependency Updates
    • Gradle Publishing Plugin 0.17.0 - #4270
    • Shadow 7.1.0 - #4269
    • Dokka 1.5.31 - #4268
    • Binary Compatibility Validator 0.8.0 - #4267
    • Reflections 0.10.2 - #4266
    • Upgrade to Gradle 7.3 - #4254
    • Dokka 1.5.30 - #4114
    • Kotlin 1.5.31 - #4113
    • Update dependencies - #4065
    Housekeeping & Refactorings
    • Minor typo fix and code refactoring - #4284
    • Improve Tests of UnnecesaryLet - #4282
    • Fix typo in UnnecessaryLet - #4281
    • Fix typo in Gradle lib definition - #4255
    • Rename DoubleMutabilityInCollectionSpec to DoubleMutabilityForCollectionSpec - #4251
    • Simplify conditional checks to improve coverage - #4221
    • Refactor NoTabs to remove DetektVisitor - #4220
    • Fix typos and grammar in rule descriptions - #4219
    • Use Kotlin's ArrayDeque implementation - #4218
    • Update Kotlin docs URL - #4217
    • Report UntilInsteadOfRangeTo for 'rangeTo' calls - #4212
    • Add tests for merging reports - #4199
    • Setup Gradle functional tests - #4074
    • GitHub Actions cache fixes - #3723
    • Simplify where casts used unnecessarily - #4213
    • Don't specify Gradle Enterprise Gradle Plugin version - #4210
    • Fix baserule import in tests - #4189
    • Run CLI sanity checks with Gradle - #4186
    • Use Codecov GitHub Action to upload coverage - #4184
    • Enable ParameterListWrapping rule on detekt codebase - #4178
    • Add test cases for MagicNumber - #4152
    • Fix FunctionParameterNamingSpec - #4145
    • Address feedback on #4139 - #4143
    • Don't skip tests that now pass - #4142
    • Fixes for Kotlin 1.6.0-M1 - #4139
    • Don't unnecessarily propogate opt-in requirement - #4116
    • Drop junit-platform-launcher dependency - #4115
    • Ensure detekt-tooling public API is stable - #4112
    • Fix globing typo - #4107
    • Rename and split ValidateConfig files - #4105
    • Dynamic deprecation - #4104
    • Fix indent issues with continuation indent - #4103
    • Refactor so detekt-gradle-plugin can be added as an included build - #4094
    • Migrate buildSrc to composite build - #4090
    • Fix broken applySelfAnalysisVersion task - #4082
    • Convert DetektJvmSpec to use ProjectBuilder - #4075
    • Upscale JVM settings - #4057
    • Gradle 7.2 - #4056
    • Verify at compile time that issue id matches rule name - #4047

    See all issues at: 1.19.0

    Source code(tar.gz)
    Source code(zip)
    detekt-cli-1.19.0-RC2-all.jar(55.49 MB)
    detekt-cli-1.19.0-RC2.zip(50.65 MB)
    detekt-formatting-1.19.0-RC2.jar(597.64 KB)
  • v1.19.0-RC1(Nov 1, 2021)

    v1.19.0-RC1 - 2021-10-31

    Notable Changes
    • We now offer an ignoreAnnotated configuration key that you can use on all your rules to suppress findings if inside an annotated block (e.g. @Composable) - #4102
    • Report configuration is changing in the Gradle plugin. The reports extension on the detekt extension has been deprecated. See the Migration section below for steps to migrate to the new recommended configuration - #3687
    • The ExplicitCollectionElementAccessMethod rule is now a type-resolution only rule - #4201
    • The InvalidPackageDeclaration rule has been split to create the MissingPackageDeclaration rule - #4149
    • The ForbiddenComment rule now offer a customMessage configuration key - #4126
    • We bumped ktlint and updated the default enabled rules to mirror what ktlint is doing - #4179
    • Add a new ConsoleReport format - #4027
    • Gradle: We removed the afterEvaluate wrapper from the Android and KMM plugin - #4159
    • We now test against Java 17 and stopped testing against Java 16 - #4136
    • Remove library specific configurations like Jetpack Compose and Dagger from the default config - #4101
    • Remove detekt-bom module - #4043
    • Use reference in fallback property delegate - #3982
    Migration

    Configuring reports in the Gradle plugin should be done at the task level instead of at the extension (or global) level. The previous recommendation resulted in the report output for multiple tasks overwriting each other when multiple detekt tasks were executed in the same Gradle run.

    Before this release the recommended way to configure reports was using the detekt extension:

    detekt {
        reports {
            xml {
                enabled = true
                destination = file("build/reports/detekt/detekt.xml")
            }
        }
    }
    

    This meant all detekt tasks would output the report to the same destination. From this detekt release you should enable and disable reports for all tasks using the withType Gradle method:

    // Kotlin DSL
    tasks.withType<Detekt>().configureEach {
        reports {
            xml.required.set(true)
        }
    }
    
    // Groovy DSL
    tasks.withType(Detekt).configureEach {
        reports {
            xml.required.set(true)
        }
    }
    

    To customize the report output location configure the task individually:

    tasks.detektMain {
        reports {
            xml {
                outputLocation.set(file("build/reports/detekt/customPath.xml"))
                required.set(true) // reports can also be enabled and disabled at the task level as needed
            }
        }
    }
    
    Changelog
    • ForbiddenMethodCall: report overriding method calls - #4205
    • ObjectLiteralToLambda: fix false positive when using Java interfaces with default methods - #4203
    • Unit tests for TooGenericExceptionThrown - #4198
    • Display correct --jvm-target values when using --help flag - #4195
    • Improved MaximumLineLength documentation - #4188
    • Report NewLineAtEndOfFile source location at end of file - #4187
    • #4169 OutdatedDocumentation rule - #4185
    • Don't report on platform types in NullableToStringCall - #4180
    • Fix #4140: Allow Bazel based tests to run with string test input - #4170
    • Improve ForbiddenMethodCall documentation - #4166
    • Report SwallowedException on catchParameter - #4158
    • Enable binary compatibility validator for detekt-test and detekt-test-api - #4157
    • Fix issues with Elvis operator in UnconditionalJumpStatementInLoop - #4150
    • Improve documentation for naming rules - #4146
    • Disable UnsafeCallOnNullableType on tests - #4123
    • Remove annotations from LateinitUsage noncompliant block - #4100
    • UnnecessaryAbstractClass: false positive when the abstract class has internal/protected abstract members - #4099
    • Deprecate DefaultContext - #4098
    • Fix confusing message when breaking the MultilineLambdaItParameter rule - #4089
    • Remove deprecated KotlinExtension - #4063
    • Add an alias for FunctionMinLength/FunctionMaxLength rules to be more descriptive - #4050
    • fix report path, default path is reports/detekt/... - #4034
    • Fix TextLocation of Indentation rule - #4030
    • detekt-bom is going away after 1.18.0 - #3988
    • UnderscoresInNumericLiterals acceptableDecimalLength is off by one - #3972
    • Create rule set configurations in a safe way - #3964
    • Remove UnnecessarySafeCall safeguard against ErrorType - #3439
    Dependency Updates
    Housekeeping & Refactorings
    • Simplify where casts used unnecessarily - #4213
    • Don't specify Gradle Enterprise Gradle Plugin version - #4210
    • Fix baserule import in tests - #4189
    • Run CLI sanity checks with Gradle - #4186
    • Use Codecov GitHub Action to upload coverage - #4184
    • Enable ParameterListWrapping rule on detekt codebase - #4178
    • Add test cases for MagicNumber - #4152
    • Fix FunctionParameterNamingSpec - #4145
    • Address feedback on #4139 - #4143
    • Don't skip tests that now pass - #4142
    • Fixes for Kotlin 1.6.0-M1 - #4139
    • Don't unnecessarily propogate opt-in requirement - #4116
    • Drop junit-platform-launcher dependency - #4115
    • Ensure detekt-tooling public API is stable - #4112
    • Fix globing typo - #4107
    • Rename and split ValidateConfig files - #4105
    • Dynamic deprecation - #4104
    • Fix indent issues with continuation indent - #4103
    • Refactor so detekt-gradle-plugin can be added as an included build - #4094
    • Migrate buildSrc to composite build - #4090
    • Fix broken applySelfAnalysisVersion task - #4082
    • Convert DetektJvmSpec to use ProjectBuilder - #4075
    • Upscale JVM settings - #4057
    • Gradle 7.2 - #4056
    • Verify at compile time that issue id matches rule name - #4047

    See all issues at: 1.19.0

    Source code(tar.gz)
    Source code(zip)
    detekt-cli-1.19.0-RC1-all.jar(55.46 MB)
    detekt-cli-1.19.0-RC1.zip(50.62 MB)
    detekt-formatting-1.19.0-RC1.jar(597.64 KB)
  • v1.18.1(Aug 30, 2021)

    • 2021-08-30

    This is a point release for Detekt 1.18.0 containing bugfixes for problems that got discovered just after the release.

    Notable Changes

    • MultiRule should pass correctly the BindingContext - #4071
    • Allow active, excludes and includes in the rule-set configuration - #4045
    • Remove Error from ThrowingExceptionsWithoutMessageOrCause because is a common name - #4046
    • Fix issue IDs for ReferentialEquality and DoubleMutability - #4040

    See all issues at: 1.18.1

    Source code(tar.gz)
    Source code(zip)
    detekt-cli-1.18.1-all.jar(54.89 MB)
    detekt-cli-1.18.1.zip(49.99 MB)
    detekt-formatting-1.18.1.jar(596.21 KB)
  • v1.18.0(Aug 12, 2021)

    1.18.0 - 2021-08-12

    We're more than excited to introduce you a next stable release of Detekt: 1.18.0 🎉 This release is coming with a lot of changes, new rules, evolution in the API and stability improvements.

    We want to take the opportunity to thank our contributors for testing, bug reporting and helping us release this new version of Detekt.

    Notable Changes

    • We've added two new rules: AvoidReferentialEquality and BooleanPropertyNaming (see #3924 and #3795)
    • This version of Detekt ships with Kotlin 1.5.21, and we're compiling with apiVersion set to 1.4 - #3956 and #3852
    • The minimum version of Gradle to use Detekt Gradle Plugin is now 6.1 - #3830
    • This version of Detekt has been tested against Java 16 - #3698
    • We fixed a long-standing bug related to parallel execution (#3248) - #3799 and #3822
    • We now use multi-line format for list options in the default detekt config file - #3827
    • The rule VarCouldBeVal has been updated and now works only with type resolution to provide more precise findings - #3880
    • We removed all the references to Extensions.getRootArea that is now deprecated from our codebase. This was affecting users with sporadic crashes. - #3848
    • For detekt rule authors: We created a Github Template that you can use to bootstrap your custom rule project: detekt-custom-rule-template. You can use JitPack to host it and share your rule easily with other members of the community.
    • For detekt rule authors: We finished the rework to use the annotations instead of kdoc tags in rules. Specifically configurations must be configured using @Configuration while auto-correction capability should be specified with the @AutoCorrectable annotation #3820.

    Migration

    • We renamed the input property inside the detekt{} extension of the Gradle plugin to source. The input property has been deprecated, and we invite you to migrate to the new property (see #3951)
    // BEFORE
    detekt {
        input = files(...)
    }
    
    // AFTER
    detekt {
        source = files(...)
    }
    
    • For all rule authors: When accessing a config value within a rule, using valueOrDefault and valueOrDefaultCommaSeparated is no longer recommended. While both will remain part of the public api, they should be replaced by one of the config delegates (see #3891). The key that is used to lookup the configured value is derived from the property name.
    /* simple property */
    // BEFORE
    val ignoreDataClasses = valueOrDefault("ignoreDataClasses", true)
    // AFTER
    val ignoreDataClasses: Boolean by config(true)
    
    /* transformed simple property */
    // BEFORE
    val ignoredName = valueOrDefault("ignoredName", "").trim()
    // AFTER
    val ignoredName: String by config("", String::trim)
    
    /* transformed list property */
    // BEFORE
    val ignoreAnnotated = valueOrDefaultCommaSeparated("ignoreAnnotated", listOf("Inject", "Value"))
            .map(String::trim)
    // AFTER
    val ignoreAnnotated: List<String> by config(listOf("Inject", "Value")) { list -> 
        list.map(String::trim) 
    }
    
    • For all rule authors: The types ThresholdRule and LazyRegex have been marked as deprecated and will be removed in a future release. Please migrate to config delegates.
    /* ThresholdRule */
    // BEFORE
    class MyRule(config: Config, threshold: Int = 10) : ThresholdRule(config, threshold) {
        // ...
    }
    // AFTER
    class MyRule(config: Config) : Rule(config) {
        private val threshold: Int by config(10)
        // ...
    }
    
    /* LazyRegex */
    // BEFORE
    private val allowedPattern: Regex by LazyRegex("allowedPatterns", "")
    // AFTER
    private val allowedPattern: Regex by config("", String::toRegex)
    
    • For custom rule authors: This will be the last version of detekt where we publish the detekt-bom artifact. This change should not affect anyone. If it affects you, please let us know.

    Changelog

    • [KMP] Fix resolution of Android test classpaths - #4026
    • Sort config lists - #4014
    • Multiplatform tasks should not depend on check - #4025
    • mark configWithFallback as unstable - #4028
    • UseDataClass: fix false positive on value classes - #4016
    • ImplicitUnitReturnType: don't report when expression body is 'Unit' - #4011
    • Fix false positive with UnusedPrivateMember on parameter of a protected function - #4007
    • ClassNaming: Don't treat Kotlin syntax ` as part of class name - #3977
    • IgnoredReturnValue: fix false negative when annotation is on the class - #3979
    • NoNameShadowing: fix false positive with nested lambda has implicit parameter - #3991
    • UnusedPrivateMember - added handling of overloaded array get operator - #3666
    • Publish bundled/Shadow JAR artifact to Maven repos - #3986
    • EmptyDefaultConstructor false positive with expect and actual classes - #3970
    • FunctionNaming - Allow factory function names - fix #1639 - #3973
    • EndOfSentenceFormat - Fix #3893 by only calling super.visit once - #3904
    • UndocumentedPublicFunction: don't report when nested class is inside not public class #3962
    • Fail with a meaningful error message for invalid boolean - #3931
    • UndocumentedPublicProperty and UndocumentedPublicFunction should include objects - #3940
    • Fix exclusion pattern for InvalidPackageDeclaration - #3907
    • Allow else when {...} in MandatoryBracesIfStatements rule - #3905
    • Remove unnecessary constant declaration - #3903
    • Check bindingContext only once in MemberNameEqualsClassName - #3899
    • LongMethod: add 'ignoreAnnotated' configuration option - #3892
    • Fix Deprecation rule message - #3885
    • Improve LongParameterList rule by supporting ignoring annotated parameters - #3879
    • OptionalUnit: fix false positive when function initializer is Nothing type - #3876
    • UnnecessaryParentheses: fix false positive for delegated expressions - #3858
    • Fix UnnecessaryLet false positive in inner lambdas - #3841
    • Fix false positive for UnusedPrivateMember - Backtick identifiers - #3828
    • Properly apply test excludes for comments - #3815
    • Fix generation issues around (deprecated) list properties - #3813
    • Update the implementation of ClassOrdering to handle false negatives - #3810
    • [comments] Do not exclude tests globally - #3801
    • UnnecessaryLet: report when implicit parameter isn't used - #3794
    • NoNameShadowing: don't report when implicit 'it' parameter isn't used - #3793
    • Fix ModifierOrder to support value class - #3719
    • Remove inline value class to stay compatible with Kotlin 1.4 API - #3871
    • [FunctionNaming] Revert annotations that are ignored by default - #3948
    • Android: add javac intermediates to classpath - [#3867]((https://github.com/detekt/detekt/pull/3867)
    • Revert "Android: add javac intermediates to classpath (#3867)" - [#3958]((https://github.com/detekt/detekt/pull/3958)
    • Use annotations to configure rules in detekt-rules-exceptions - #3798
    • Use @Configuration in detekt-rules-style - #3774
    • Use annotations to configure rules in custom-checks - #3773
    • Use @Configuration for rules-errorprone - #3772
    • Use annotation to configure rules in rules-empty - #3771
    • Use annotation to configure rules in rules-documentation - #3770
    • Use annotations to configure rules in rules-naming - #3769
    • Use annotations to configure rules in rules-complexity - #3768
    • Move formatting rules to @Configuration - #3847

    Dependency Updates

    • Bump Kotlin to 1.5.21 - #3956
    • Revert "Bump Kotlin to v1.5.20" - #3941
    • Bump Kotlin to v1.5.20 - #3921
    • Kotlin 1.5.10 - #3826
    • Update assertj to v3.20.2 - #3912
    • Update snakeyaml to v1.29 - #3911
    • Bump byte-buddy from 1.11.2 to 1.11.5 - #3886
    • Bump byte-buddy from 1.11.1 to 1.11.2 - #3872
    • Bump byte-buddy from 1.11.0 to 1.11.1 - #3861
    • Update mockk to 1.12.0 - #3937

    Housekeeping & Refactorings

    • Enable UnnecessaryLet rule for detekt code base - #4024
    • enable PreferToOverPairSyntax rule for detekt code base - #4023
    • Add IllegalArgumentException and IllegalStateException to ThrowingExceptionsWithoutMessageOrCause - #4013
    • enable more potential-bugs rules for detekt code base - #3997
    • enable more exception rules for detekt code base - #3995
    • Enable UseOrEmpty for detekt code base - #3999
    • enable those rules from the style rule set that have not violation or obvious fixes - #3998
    • Enable more rules from naming rule set for detekt code base - #3996
    • Enable UseEmptyCounterpart for detekt code base - #4000
    • enable coroutine rules for detekt code base - #3994
    • Remove "plugin" suffix from version catalog aliases - #3987
    • Fix ClassCastException in test on java 11 openjdk9 - #3984
    • Activate IgnoredReturnValue on detekt code base - #3974
    • Add missing test in FunctionNaming - #3976
    • Fix trunk compilation - #3968
    • Reformat internal detekt.yml using multi line lists - #3936
    • Increase memory available to gradle integration test daemon - #3938
    • Avoid empty lines when running detekt with type resolution - #3909
    • Fix java.lang.ClassCastException is reading default yaml config - #3920
    • Refactor + rename util function inside MandatoryBracesIfStatement rule - #3908
    • Rename Tests to Spec - #3906
    • verify that no rule is configured with kdoc tags - #3870
    • Setup FOSSA - #3836
    • jvmTarget can't be null - #3818
    • Add test for ruleset provider configuration - #3814
    • Merge JaCoCo coverage reports the "right" way - #3650
    • Update outdated Gradle plugin documentation regarding source files - #3883
    • Make documentation more precise about how rules are enabled - #3889
    • Rename MapGetWithNotNullAsserSpec to follow test convention - #3878
    • Remove custom assertions that check kdoc of rules - #3859
    • Avoid overlapping outputs - #3790
    • Revert "Avoid overlapping outputs" - #3943

    See all issues at: 1.18.0

    Source code(tar.gz)
    Source code(zip)
    detekt-cli-1.18.0-all.jar(54.89 MB)
    detekt-cli-1.18.0.zip(49.99 MB)
    detekt-formatting-1.18.0.jar(596.21 KB)
  • v1.18.0-RC3(Aug 5, 2021)

    1.18.0-RC3 - 2021-08-05

    Notable Changes

    • We've added two new rules: AvoidReferentialEquality and BooleanPropertyNaming (see #3924 and #3795)
    • This version of Detekt ships with Kotlin 1.5.21, and we're compiling with apiVersion set to 1.4 - #3956 and #3852
    • The minimum version of Gradle to use Detekt Gradle Plugin is now 6.1 - #3830
    • This version of Detekt has been tested against Java 16 - #3698
    • We fixed a long-standing bug related to parallel execution (#3248) - #3799 and #3822
    • We now use multi-line format for list options in the default detekt config file - #3827
    • The rule VarCouldBeVal has been updated and now works only with type resolution to provide more precise findings - #3880
    • We removed all the references to Extensions.getRootArea that is now deprecated from our codebase. This was affecting users with sporadic crashes. - #3848

    Migration

    • We renamed the input property inside the detekt{} extension of the Gradle plugin to source. The input property has been deprecated, and we invite you to migrate to the new property (see #3951)
    // BEFORE
    detekt {
        input = files(...)
    }
    
    // AFTER
    detekt {
        source = files(...)
    }
    
    • For custom rule authors: we finished the rework to use the annotations in custom rules. Specifically configurations should be configured with @Configuration and a config delegate (see #3891) while auto-correction capability should be specified with the @AutoCorrectable annotation #3820.

    • For custom rule authors: This will be the last version of detekt where we publish the detekt-bom artifact. This change should not affect anyone. If it affects you, please let us know.

    Changelog

    • ClassNaming: Don't treat Kotlin syntax ` as part of class name - #3977
    • IgnoredReturnValue: fix false negative when annotation is on the class - #3979
    • NoNameShadowing: fix false positive with nested lambda has implicit parameter - #3991
    • UnusedPrivateMember - added handling of overloaded array get operator - #3666
    • Publish bundled/Shadow JAR artifact to Maven repos - #3986
    • EmptyDefaultConstructor false positive with expect and actual classes - #3970
    • FunctionNaming - Allow factory function names - fix #1639 - #3973
    • EndOfSentenceFormat - Fix #3893 by only calling super.visit once - #3904
    • UndocumentedPublicFunction: don't report when nested class is inside not public class #3962
    • Fail with a meaningful error message for invalid boolean - #3931
    • UndocumentedPublicProperty and UndocumentedPublicFunction should include objects - #3940
    • Fix exclusion pattern for InvalidPackageDeclaration - #3907
    • Allow else when {...} in MandatoryBracesIfStatements rule - #3905
    • Remove unnecessary constant declaration - #3903
    • Check bindingContext only once in MemberNameEqualsClassName - #3899
    • LongMethod: add 'ignoreAnnotated' configuration option - #3892
    • Fix Deprecation rule message - #3885
    • Improve LongParameterList rule by supporting ignoring annotated parameters - #3879
    • OptionalUnit: fix false positive when function initializer is Nothing type - #3876
    • UnnecessaryParentheses: fix false positive for delegated expressions - #3858
    • Fix UnnecessaryLet false positive in inner lambdas - #3841
    • Fix false positive for UnusedPrivateMember - Backtick identifiers - #3828
    • Properly apply test excludes for comments - #3815
    • Fix generation issues around (deprecated) list properties - #3813
    • Update the implementation of ClassOrdering to handle false negatives - #3810
    • [comments] Do not exclude tests globally - #3801
    • UnnecessaryLet: report when implicit parameter isn't used - #3794
    • NoNameShadowing: don't report when implicit 'it' parameter isn't used - #3793
    • Fix ModifierOrder to support value class - #3719
    • Remove inline value class to stay compatible with Kotlin 1.4 API - #3871
    • [FunctionNaming] Revert annotations that are ignored by default - #3948
    • Android: add javac intermediates to classpath - [#3867]((https://github.com/detekt/detekt/pull/3867)
    • Revert "Android: add javac intermediates to classpath (#3867)" - [#3958]((https://github.com/detekt/detekt/pull/3958)
    • Use annotations to configure rules in detekt-rules-exceptions - #3798
    • Use @Configuration in detekt-rules-style - #3774
    • Use annotations to configure rules in custom-checks - #3773
    • Use @Configuration for rules-errorprone - #3772
    • Use annotation to configure rules in rules-empty - #3771
    • Use annotation to configure rules in rules-documentation - #3770
    • Use annotations to configure rules in rules-naming - #3769
    • Use annotations to configure rules in rules-complexity - #3768
    • Move formatting rules to @Configuration - #3847

    Dependency Updates

    • Bump Kotlin to 1.5.21 - #3956
    • Revert "Bump Kotlin to v1.5.20" - #3941
    • Bump Kotlin to v1.5.20 - #3921
    • Kotlin 1.5.10 - #3826
    • Update assertj to v3.20.2 - #3912
    • Update snakeyaml to v1.29 - #3911
    • Bump byte-buddy from 1.11.2 to 1.11.5 - #3886
    • Bump byte-buddy from 1.11.1 to 1.11.2 - #3872
    • Bump byte-buddy from 1.11.0 to 1.11.1 - #3861
    • Update mockk to 1.12.0 - #3937

    Housekeeping & Refactorings

    • Enable UseEmptyCounterpart for detekt code base - #4000
    • enable coroutine rules for detekt code base - #3994
    • Remove "plugin" suffix from version catalog aliases - #3987
    • Fix ClassCastException in test on java 11 openjdk9 - #3984
    • Activate IgnoredReturnValue on detekt code base - #3974
    • Add missing test in FunctionNaming - #3976
    • Fix trunk compilation - #3968
    • Reformat internal detekt.yml using multi line lists - #3936
    • Increase memory available to gradle integration test daemon - #3938
    • Avoid empty lines when running detekt with type resolution - #3909
    • Fix java.lang.ClassCastException is reading default yaml config - #3920
    • Refactor + rename util function inside MandatoryBracesIfStatement rule - #3908
    • Rename Tests to Spec - #3906
    • verify that no rule is configured with kdoc tags - #3870
    • Setup FOSSA - #3836
    • jvmTarget can't be null - #3818
    • Add test for ruleset provider configuration - #3814
    • Merge JaCoCo coverage reports the "right" way - #3650
    • Update outdated Gradle plugin documentation regarding source files - #3883
    • Make documentation more precise about how rules are enabled - #3889
    • Rename MapGetWithNotNullAsserSpec to follow test convention - #3878
    • Remove custom assertions that check kdoc of rules - #3859
    • Avoid overlapping outputs - #3790
    • Revert "Avoid overlapping outputs" - #3943

    See all issues at: 1.18.0

    Source code(tar.gz)
    Source code(zip)
    detekt-cli-1.18.0-RC3-all.jar(54.89 MB)
    detekt-cli-1.18.0-RC3.zip(49.99 MB)
    detekt-formatting-1.18.0-RC3.jar(596.20 KB)
  • v1.18.0-RC2(Jul 16, 2021)

    2021-07-16

    Notable Changes

    • This version of Detekt ships with Kotlin 1.5.21, and we're compiling with apiVersion set to 1.4 - #3956 and #3852
    • The minimum version of Gradle to use Detekt Gradle Plugin is now 6.1 - #3830
    • This version of Detekt has been tested against Java 16 - #3698
    • We fixed a long-standing bug related to parallel execution (#3248) - #3799 and #3822
    • We now use multi-line format for list options in the default detekt config file - #3827
    • The rule VarCouldBeVal has been updated and now works only with type resolution to provide more precise findings - #3880
    • We removed all the references to Extensions.getRootArea that is now deprecated from our codebase. This was affecting users with sporadic crashes. - #3848
    • We continued the work to introduce annotations to declare rules metadata. Specifically the @Autocorrect annotation has been added - #3820

    Changelog

    • UndocumentedPublicProperty and UndocumentedPublicFunction should include objects - #3940
    • Fix exclusion pattern for InvalidPackageDeclaration - #3907
    • Allow else when {...} in MandatoryBracesIfStatements rule - #3905
    • Remove unnecessary constant declaration - #3903
    • Check bindingContext only once in MemberNameEqualsClassName - #3899
    • LongMethod: add 'ignoreAnnotated' configuration option - #3892
    • Fix Deprecation rule message - #3885
    • Improve LongParameterList rule by supporting ignoring annotated parameters - #3879
    • OptionalUnit: fix false positive when function initializer is Nothing type - #3876
    • UnnecessaryParentheses: fix false positive for delegated expressions - #3858
    • Fix UnnecessaryLet false positive in inner lambdas - #3841
    • Fix false positive for UnusedPrivateMember - Backtick identifiers - #3828
    • Properly apply test excludes for comments - #3815
    • Fix generation issues around (deprecated) list properties - #3813
    • Update the implementation of ClassOrdering to handle false negatives - #3810
    • [comments] Do not exclude tests globally - #3801
    • UnnecessaryLet: report when implicit parameter isn't used - #3794
    • NoNameShadowing: don't report when implicit 'it' parameter isn't used - #3793
    • Fix ModifierOrder to support value class - #3719
    • Remove inline value class to stay compatible with Kotlin 1.4 API - #3871
    • [FunctionNaming] Revert annotations that are ignored by default - #3948
    • Android: add javac intermediates to classpath - [#3867]((https://github.com/detekt/detekt/pull/3867)
    • Revert "Android: add javac intermediates to classpath (#3867)" - [#3958]((https://github.com/detekt/detekt/pull/3958)
    • Use annotations to configure rules in detekt-rules-exceptions - #3798
    • Use @Configuration in detekt-rules-style - #3774
    • Use annotations to configure rules in custom-checks - #3773
    • Use @Configuration for rules-errorprone - #3772
    • Use annotation to configure rules in rules-empty - #3771
    • Use annotation to configure rules in rules-documentation - #3770
    • Use annotations to configure rules in rules-naming - #3769
    • Use annotations to configure rules in rules-complexity - #3768
    • Move formatting rules to @Configuration - #3847

    Dependency Updates

    • Bump Kotlin to 1.5.21 - #3956
    • Revert "Bump Kotlin to v1.5.20" - #3941
    • Bump Kotlin to v1.5.20 - #3921
    • Kotlin 1.5.10 - #3826
    • Update assertj to v3.20.2 - #3912
    • Update snakeyaml to v1.29 - #3911
    • Bump byte-buddy from 1.11.2 to 1.11.5 - #3886
    • Bump byte-buddy from 1.11.1 to 1.11.2 - #3872
    • Bump byte-buddy from 1.11.0 to 1.11.1 - #3861
    • Update mockk to 1.12.0 - #3937

    Housekeeping & Refactorings

    • Increase memory available to gradle integration test daemon - #3938
    • Avoid empty lines when running detekt with type resolution - #3909
    • Fix java.lang.ClassCastException is reading default yaml config - #3920
    • Refactor + rename util function inside MandatoryBracesIfStatement rule - #3908
    • Rename Tests to Spec - #3906
    • verify that no rule is configured with kdoc tags - #3870
    • Setup FOSSA - #3836
    • jvmTarget can't be null - #3818
    • Add test for ruleset provider configuration - #3814
    • Merge JaCoCo coverage reports the "right" way - #3650
    • Update outdated Gradle plugin documentation regarding source files - #3883
    • Make documentation more precise about how rules are enabled - #3889
    • Rename MapGetWithNotNullAsserSpec to follow test convention - #3878
    • Remove custom assertions that check kdoc of rules - #3859
    • Avoid overlapping outputs - #3790
    • Revert "Avoid overlapping outputs" - #3943

    See all issues at: 1.18.0

    Source code(tar.gz)
    Source code(zip)
    detekt-cli-1.18.0-RC2-all.jar(54.87 MB)
    detekt-cli-1.18.0-RC2.zip(49.98 MB)
    detekt-formatting-1.18.0-RC2.jar(596.21 KB)
  • v1.18.0-RC1(Jul 8, 2021)

    1.18.0-RC1 - 2021-07-08

    Notable Changes

    • This version of Detekt ships with Kotlin 1.5.x, and we're compiling with apiVersion set to 1.4 - #3718 and #3852
    • The minimum version of Gradle to use Detekt Gradle Plugin is now 6.1 - #3830
    • This version of Detekt has been tested against Java 16 - #3698
    • We fixed a long-standing bug related to parallel execution (#3248) - #3799 and #3822
    • We now use multi-line format for list options in the default detekt config file - #3827
    • The rule VarCouldBeVal has been updated and now works only with type resolution to provide more precise findings - #3880
    • We removed all the references to Extensions.getRootArea that is now deprecated from our codebase. This was affecting users with sporadic crashes. - #3848
    • For Android projects using Detekt Gradle plugins, we now add javac intermediates to classpath. This will allow running more precise type resolutions inspections - #3867
    • We continued the work to introduce annotations to declare rules metadata. Specifically the @Autocorrect annotation has been added - #3820

    Changelog

    • UndocumentedPublicProperty and UndocumentedPublicFunction should include objects - #3940
    • Fix exclusion pattern for InvalidPackageDeclaration - #3907
    • Allow else when {...} in MandatoryBracesIfStatements rule - #3905
    • Remove unnecessary constant declaration - #3903
    • Check bindingContext only once in MemberNameEqualsClassName - #3899
    • LongMethod: add 'ignoreAnnotated' configuration option - #3892
    • Fix Deprecation rule message - #3885
    • Improve LongParameterList rule by supporting ignoring annotated parameters - #3879
    • OptionalUnit: fix false positive when function initializer is Nothing type - #3876
    • UnnecessaryParentheses: fix false positive for delegated expressions - #3858
    • Fix UnnecessaryLet false positive in inner lambdas - #3841
    • Fix false positive for UnusedPrivateMember - Backtick identifiers - #3828
    • Properly apply test excludes for comments - #3815
    • Fix generation issues around (deprecated) list properties - #3813
    • Update the implementation of ClassOrdering to handle false negatives - #3810
    • [comments] Do not exclude tests globally - #3801
    • UnnecessaryLet: report when implicit parameter isn't used - #3794
    • NoNameShadowing: don't report when implicit 'it' parameter isn't used - #3793
    • Fix ModifierOrder to support value class - #3719
    • Remove inline value class to stay compatible with Kotlin 1.4 API - #3871
    • Use annotations to configure rules in detekt-rules-exceptions - #3798
    • Use @Configuration in detekt-rules-style - #3774
    • Use annotations to configure rules in custom-checks - #3773
    • Use @Configuration for rules-errorprone - #3772
    • Use annotation to configure rules in rules-empty - #3771
    • Use annotation to configure rules in rules-documentation - #3770
    • Use annotations to configure rules in rules-naming - #3769
    • Use annotations to configure rules in rules-complexity - #3768
    • Move formatting rules to @Configuration - #3847

    Dependency Updates

    • Revert "Bump Kotlin to v1.5.20" - #3941
    • Bump Kotlin to v1.5.20 - #3921
    • Kotlin 1.5.10 - #3826
    • Update assertj to v3.20.2 - #3912
    • Update snakeyaml to v1.29 - #3911
    • Bump byte-buddy from 1.11.2 to 1.11.5 - #3886
    • Bump byte-buddy from 1.11.1 to 1.11.2 - #3872
    • Bump byte-buddy from 1.11.0 to 1.11.1 - #3861

    Housekeeping & Refactorings

    • Increase memory available to gradle integration test daemon - #3938
    • Avoid empty lines when running detekt with type resolution - #3909
    • Fix java.lang.ClassCastException is reading default yaml config - #3920
    • Refactor + rename util function inside MandatoryBracesIfStatement rule - #3908
    • Rename Tests to Spec - #3906
    • verify that no rule is configured with kdoc tags - #3870
    • Setup FOSSA - #3836
    • jvmTarget can't be null - #3818
    • Add test for ruleset provider configuration - #3814
    • Merge JaCoCo coverage reports the "right" way - #3650
    • Update outdated Gradle plugin documentation regarding source files - #3883
    • Make documentation more precise about how rules are enabled - #3889
    • Rename MapGetWithNotNullAsserSpec to follow test convention - #3878
    • Remove custom assertions that check kdoc of rules - #3859

    See all issues at: 1.18.0

    Source code(tar.gz)
    Source code(zip)
    detekt-cli-1.18.0-RC1-all.jar(53.69 MB)
    detekt-cli-1.18.0-RC1.zip(48.90 MB)
    detekt-formatting-1.18.0-RC1.jar(596.21 KB)
  • v1.17.1(May 21, 2021)

    • 2021-05-19
    Notable Changes

    This is a patch release for Detekt 1.17.0 including fixes that we considered worth a point release.

    Specifically, we're reverting a change on our Gradle Plugin. The original change #3655 resulted in several false positives when using rules with Type Resolution on Java/Kotlin mixed codebases.

    Moreover we included a couple of false positive fixes for NoNameShadowing and UnnecessaryLet

    Changelog
    • Revert "Noisy gradle (#3655)" - #3792
    • NoNameShadowing: don't report when implicit 'it' parameter isn't used - #3793
    • UnnecessaryLet: report when implicit parameter isn't used - #3794
    Source code(tar.gz)
    Source code(zip)
    detekt-cli-1.17.1-all.jar(54.08 MB)
    detekt-cli-1.17.1.zip(49.12 MB)
    detekt-formatting-1.17.1.jar(597.33 KB)
  • v1.17.0(May 15, 2021)

    • 2021-05-15

    Notable Changes

    • We're introducing our new Project logo :). See #3726
    • This release allows you to replace your jcenter() dependencies with mavenCentral() given that our dependency on kotlinx.html migrated to Maven Central - See #3455
    • We now introduced the src/test/java and src/test/kotlin by default for the plain detekt Gradle task. If you use that task, you might notice rule reports in your test sourceset. See #3649
    • We now default the baseline file to detekt-baseline.xml so you don't have to specify it manually. You can revert the previous behavior by setting the baseline to null - See #3619 and #3745
    • We enabled the SARIF output format by default - See #3543
    • We're introducing annotations to provide metadata to rules, such as @ActiveByDefault, @Configuration and @RequiresTypeResolution - See #3637 #3592 and #3579

    Changelog

    • Fix crash for DontDowncastCollectionTypes on Synthetic types - #3776
    • We don't need to talk about jcenter anymore at our docs - #3755
    • Skip publishing for detekt-cli shadowRuntimeElements variant - #3747
    • Set the org.gradle.dependency.bundling attribute to external - #3738
    • Support triple quoted strings in default value of config delegate - #3733
    • Properly populate versions.properties - #3730
    • We have a logo :) - #3726
    • [UndocumentedPublicProperty] Allow inline comments for properties in primary constructor as documentation - #3722
    • MultilineLambdaItParameter: don't report when lambda has no implicit parameter references - #3696
    • Fix false positives for UnnecessaryFilter - #3695
    • Add support for transformer function in config property delegate - #3676
    • Add support for fallback property - #3675
    • Ignore actual members in UnusedPrivateMember - #3669
    • NamedArguments rule: fix false positive with trailing lambda - #3661
    • Add DeprecatedBlockTag rule - #3660
    • Noisy gradle - #3655
    • Drop support to Gradle 5 - #3647
    • Add MayBeConstant as alias for MayBeConst - #3644
    • [ThrowingExceptionInMain] [ExitOutsideMainfix] fix for KtNamedFunction.isMainFunction() - #3641
    • Fixing IllegalArgumentException in ForbiddenMethodCall rule for Intersection type parameters - #3626
    • Replace getJetTypeFqName with fqNameOrNull extension - #3613
    • New Rule: ObjectLiteralToLambda - #3599
    • [MemberNameEqualsClassName] Support factory exemption for generic classes - #3595
    • Refactor Analyzer so that RuleSetProvider.instance is only called once - #3585
    • SarifOutputReportSpec: Correctly detect Windows root directory on local development machine - #3584
    • Replace @since KDoc tag with @SinceDetekt - #3582
    • Simplify code in RedundantSuspendModifier rule - #3580
    • Revert "Refactor Analyzer so that RuleSetProvider.instance is only called once" - #3578
    • fix error message -> buildUponDefaultConfig instead of buildOnDefaultConfig - #3572
    • UnnecessaryApply: fix false positive when lambda has multiple member references - #3564
    • Switch SARIF report off jackson - #3557
    • Fix rules not appearing in the sarif output - #3556
    • Refactor Analyzer so that RuleSetProvider.instance is only called once - #3555
    • New Rule: DoubleMutabilityForCollection - #3553
    • Adds a ForbiddenSingleExpressionSyntax rule - #3550

    Dependency Updates

    • Update to Gradle 7.0.1 - #3760
    • Update Shadow plugin to 7.0.0 - #3759
    • Upgrade to AGP 4.2.0 - #3744
    • JaCoCo 0.8.7 - #3739
    • Upgrade to GitHub-native Dependabot - #3716
    • Upgrade to Gradle 7 - #3689
    • Bump com.gradle.plugin-publish from 0.13.0 to 0.14.0 - #3654
    • Bump kotlin-reflect from 1.4.0 to 1.4.32 - #3627
    • Upgrade to ktlint 0.41.0 - #3624
    • Update to Kotlin 1.4.32 - #3606
    • Bump AGP from 4.1.2 to 4.1.3 - #3589
    • Bump mockk from 1.10.6 to 1.11.0 - #3588

    Housekeeping & Refactorings

    • Fix document - #3765
    • Fix kdoc link on blog navigation - #3761
    • Upload any heap dumps produced during CI build - #3758
    • Always run warningsAsErrors on CI - #3754
    • Clean ci - #3753
    • Revert "Set the org.gradle.dependency.bundling attribute to external" - #3750
    • Enable Gradle's type-safe project accessors - #3742
    • Enable Gradle's version catalogs - #3741
    • Ignore gradle plugin in codecov - #3740
    • Update config file due to invalid argument - #3735
    • Skip Multiplatform iOS tests if XCode is not configured - #3734
    • Specify Java language level in module plugin - #3732
    • Don't run unnecesary tasks - #3725
    • Remove --stacktrace now that we have scan - #3724
    • Drop JCenter usage from detekt's own build - #3711
    • Publish build scans for all CI builds - #3710
    • Remove deprecated kotlin-dsl Gradle config option - #3709
    • Update to setup-java@v2 - #3704
    • (Try to) improve CI build reliability - #3703
    • Simplify UpdateVersionInFileTask - #3693
    • Fix compilation issue in :detekt-rules-style:compileTestKotlin - #3691
    • Fix detekt failure in CI - #3674
    • Refactor UnusedPrivateMemberSpec - #3667
    • Warnings as errors - #3646
    • Skip ios tests if no ci - #3635
    • Fix tests - #3634
    • Include detekt-rules on CLI runtime classpath - #3625
    • Improve tests from :detekt-gradle-plugin - #3623
    • Improve generator test coverage - #3622
    • Improve tests - #3618
    • Apply more formatting rules to our code - #3615
    • Add negative test case for requiresTypeResolution - #3614
    • Simplify Gradle config - #3612
    • Decouple Gradle projects - #3611
    • Add --stacktrace to help triage CI flakiness - #3604
    • Fix CI failure for deploy-snapshot - #3598
    • Improve Deprecation and Documentation for allRules - #3596
    • Update files to support main branch in order to remove oppressive language - #3586
    • Format test code for RedundantSuspendModifierSpec - #3581
    • Gradle tweaks - #3575
    • Support Gradle config cache in detekt's build - #3574
    • Show information from @active in the website - #3569
    • Update rule doc for SwallowedException config - #3547
    • Markdown: Reintroduce double-backticks for inline code rendering - #3545

    See all issues at: 1.17.0

    Source code(tar.gz)
    Source code(zip)
    detekt-cli-1.17.0-all.jar(54.07 MB)
    detekt-cli-1.17.0.zip(49.12 MB)
    detekt-formatting-1.17.0.jar(597.32 KB)
  • v1.17.0-RC3(May 12, 2021)

    • 2021-05-12
    Notable Changes
    • We're introducing our new Project logo :). See #3726
    • This release allows you to replace your jcenter() dependencies with mavenCentral() given that our dependency on kotlinx.html migrated to Maven Central - See #3455
    • We now introduced the src/test/java and src/test/kotlin by default for the plain detekt Gradle task. If you use that task, you might notice rule reports in your test sourceset. See #3649
    • We now default the baseline file to baseline.xml so you don't have to specify it manually. You can revert the previous behavior by setting the baseline to null - See #3619
    • We enabled the SARIF output format by default - See #3543
    • We're introducing annotations to provide metadata to rules, such as @ActiveByDefault, @Configuration and @RequiresTypeResolution - See #3637 #3592 and #3579
    Changelog
    • Fix kdoc link on blog navigation - #3761
    • We don't need to talk about jcenter anymore at our docs - #3755
    • Skip publishing for detekt-cli shadowRuntimeElements variant - #3747
    • Set the org.gradle.dependency.bundling attribute to external - #3738
    • Support triple quoted strings in default value of config delegate - #3733
    • Properly populate versions.properties - #3730
    • We have a logo :) - #3726
    • [UndocumentedPublicProperty] Allow inline comments for properties in primary constructor as documentation - #3722
    • MultilineLambdaItParameter: don't report when lambda has no implicit parameter references - #3696
    • Fix false positives for UnnecessaryFilter - #3695
    • Add support for fallback property - #3675
    • Ignore actual members in UnusedPrivateMember - #3669
    • NamedArguments rule: fix false positive with trailing lambda - #3661
    • Add DeprecatedBlockTag rule - #3660
    • Noisy gradle - #3655
    • Drop support to Gradle 5 - #3647
    • Add MayBeConstant as alias for MayBeConst - #3644
    • [ThrowingExceptionInMain] [ExitOutsideMainfix] fix for KtNamedFunction.isMainFunction() - #3641
    • Fixing IllegalArgumentException in ForbiddenMethodCall rule for Intersection type parameters - #3626
    • Replace getJetTypeFqName with fqNameOrNull extension - #3613
    • New Rule: ObjectLiteralToLambda - #3599
    • [MemberNameEqualsClassName] Support factory exemption for generic classes - #3595
    • Refactor Analyzer so that RuleSetProvider.instance is only called once - #3585
    • SarifOutputReportSpec: Correctly detect Windows root directory on local development machine - #3584
    • Replace @since KDoc tag with @SinceDetekt - #3582
    • Simplify code in RedundantSuspendModifier rule - #3580
    • Revert "Refactor Analyzer so that RuleSetProvider.instance is only called once" - #3578
    • fix error message -> buildUponDefaultConfig instead of buildOnDefaultConfig - #3572
    • UnnecessaryApply: fix false positive when lambda has multiple member references - #3564
    • Switch SARIF report off jackson - #3557
    • Fix rules not appearing in the sarif output - #3556
    • Refactor Analyzer so that RuleSetProvider.instance is only called once - #3555
    • New Rule: DoubleMutabilityForCollection - #3553
    • Adds a ForbiddenSingleExpressionSyntax rule - #3550
    Dependency Updates
    • Update to Gradle 7.0.1 - #3760
    • Update Shadow plugin to 7.0.0 - #3759
    • Upgrade to AGP 4.2.0 - #3744
    • JaCoCo 0.8.7 - #3739
    • Upgrade to GitHub-native Dependabot - #3716
    • Upgrade to Gradle 7 - #3689
    • Bump com.gradle.plugin-publish from 0.13.0 to 0.14.0 - #3654
    • Bump kotlin-reflect from 1.4.0 to 1.4.32 - #3627
    • Upgrade to ktlint 0.41.0 - #3624
    • Update to Kotlin 1.4.32 - #3606
    • Bump AGP from 4.1.2 to 4.1.3 - #3589
    • Bump mockk from 1.10.6 to 1.11.0 - #3588
    Housekeeping & Refactorings
    • Upload any heap dumps produced during CI build - #3758
    • Always run warningsAsErrors on CI - #3754
    • Clean ci - #3753
    • Revert "Set the org.gradle.dependency.bundling attribute to external" - #3750
    • Enable Gradle's type-safe project accessors - #3742
    • Enable Gradle's version catalogs - #3741
    • Ignore gradle plugin in codecov - #3740
    • Update config file due to invalid argument - #3735
    • Skip Multiplatform iOS tests if XCode is not configured - #3734
    • Specify Java language level in module plugin - #3732
    • Don't run unnecesary tasks - #3725
    • Remove --stacktrace now that we have scan - #3724
    • Drop JCenter usage from detekt's own build - #3711
    • Publish build scans for all CI builds - #3710
    • Remove deprecated kotlin-dsl Gradle config option - #3709
    • Update to setup-java@v2 - #3704
    • (Try to) improve CI build reliability - #3703
    • Simplify UpdateVersionInFileTask - #3693
    • Fix compilation issue in :detekt-rules-style:compileTestKotlin - #3691
    • Fix detekt failure in CI - #3674
    • Refactor UnusedPrivateMemberSpec - #3667
    • Warnings as errors - #3646
    • Skip ios tests if no ci - #3635
    • Fix tests - #3634
    • Include detekt-rules on CLI runtime classpath - #3625
    • Improve tests from :detekt-gradle-plugin - #3623
    • Improve generator test coverage - #3622
    • Improve tests - #3618
    • Apply more formatting rules to our code - #3615
    • Add negative test case for requiresTypeResolution - #3614
    • Simplify Gradle config - #3612
    • Decouple Gradle projects - #3611
    • Add --stacktrace to help triage CI flakiness - #3604
    • Fix CI failure for deploy-snapshot - #3598
    • Improve Deprecation and Documentation for allRules - #3596
    • Update files to support main branch in order to remove oppressive language - #3586
    • Format test code for RedundantSuspendModifierSpec - #3581
    • Gradle tweaks - #3575
    • Support Gradle config cache in detekt's build - #3574
    • Show information from @active in the website - #3569
    • Update rule doc for SwallowedException config - #3547
    • Markdown: Reintroduce double-backticks for inline code rendering - #3545

    See all issues at: 1.17.0

    Source code(tar.gz)
    Source code(zip)
    detekt-cli-1.17.0-RC3-all.jar(54.07 MB)
    detekt-cli-1.17.0-RC3.zip(49.12 MB)
    detekt-formatting-1.17.0-RC3.jar(597.33 KB)
  • v1.17.0-RC2(May 3, 2021)

    • 2021-05-04

    Notable Changes

    • This release allows you to replace your jcenter() dependencies with mavenCentral() given that our dependency on kotlinx.html migrated to Maven Central - See #3455
    • We now introduced the src/test/java and src/test/kotlin by default for the plain detekt Gradle task. If you use that task, you might notice rule reports in your test sourceset. See #3649
    • We now default the baseline file to baseline.xml so you don't have to specify it manually. You can revert the previous behavior by setting the baseline to null - See #3619
    • We enabled the SARIF output format by default - See #3543
    • We're introducing annotations to provide metadata to rules, such as @ActiveByDefault, @Configuration and @RequiresTypeResolution - See #3637 #3592 and #3579

    Changelog

    • Properly populate versions.properties - #3730
    • MultilineLambdaItParameter: don't report when lambda has no implicit parameter references - #3696
    • Fix false positives for UnnecessaryFilter - #3695
    • Ignore actual members in UnusedPrivateMember - #3669
    • NamedArguments rule: fix false positive with trailing lambda - #3661
    • Add DeprecatedBlockTag rule - #3660
    • Noisy gradle - #3655
    • Drop support to Gradle 5 - #3647
    • Add MayBeConstant as alias for MayBeConst - #3644
    • [ThrowingExceptionInMain] [ExitOutsideMainfix] fix for KtNamedFunction.isMainFunction() - #3641
    • Fixing IllegalArgumentException in ForbiddenMethodCall rule for Intersection type parameters - #3626
    • Replace getJetTypeFqName with fqNameOrNull extension - #3613
    • [MemberNameEqualsClassName] Support factory exemption for generic classes - #3595
    • Refactor Analyzer so that RuleSetProvider.instance is only called once - #3585
    • SarifOutputReportSpec: Correctly detect Windows root directory on local development machine - #3584
    • Replace @since KDoc tag with @SinceDetekt - #3582
    • Simplify code in RedundantSuspendModifier rule - #3580
    • Revert "Refactor Analyzer so that RuleSetProvider.instance is only called once" - #3578
    • fix error message -> buildUponDefaultConfig instead of buildOnDefaultConfig - #3572
    • UnnecessaryApply: fix false positive when lambda has multiple member references - #3564
    • Switch SARIF report off jackson - #3557
    • Fix rules not appearing in the sarif output - #3556
    • Refactor Analyzer so that RuleSetProvider.instance is only called once - #3555
    • New Rule: DoubleMutabilityForCollection - #3553
    • Adds a ForbiddenSingleExpressionSyntax rule - #3550

    Dependency Updates

    • Upgrade to GitHub-native Dependabot - #3716
    • Upgrade to Gradle 7 - #3689
    • Bump com.gradle.plugin-publish from 0.13.0 to 0.14.0 - #3654
    • Bump kotlin-reflect from 1.4.0 to 1.4.32 - #3627
    • Upgrade to ktlint 0.41.0 - #3624
    • Update to Kotlin 1.4.32 - #3606
    • Bump AGP from 4.1.2 to 4.1.3 - #3589
    • Bump mockk from 1.10.6 to 1.11.0 - #3588

    Housekeeping & Refactorings

    • Update config file due to invalid argument - #3735
    • Specify Java language level in module plugin - #3732
    • Don't run unnecesary tasks - #3725
    • Remove --stacktrace now that we have scan - #3724
    • Drop JCenter usage from detekt's own build - #3711
    • Publish build scans for all CI builds - #3710
    • Remove deprecated kotlin-dsl Gradle config option - #3709
    • Update to setup-java@v2 - #3704
    • Simplify UpdateVersionInFileTask - #3693
    • Fix compilation issue in :detekt-rules-style:compileTestKotlin - #3691
    • Fix detekt failure in CI - #3674
    • Refactor UnusedPrivateMemberSpec - #3667
    • Warnings as errors - #3646
    • Skip ios tests if no ci - #3635
    • Fix tests - #3634
    • Include detekt-rules on CLI runtime classpath - #3625
    • Improve tests from :detekt-gradle-plugin - #3623
    • Improve generator test coverage - #3622
    • Improve tests - #3618
    • Apply more formatting rules to our code - #3615
    • Add negative test case for requiresTypeResolution - #3614
    • Simplify Gradle config - #3612
    • Decouple Gradle projects - #3611
    • Add --stacktrace to help triage CI flakiness - #3604
    • Fix CI failure for deploy-snapshot - #3598
    • Improve Deprecation and Documentation for allRules - #3596
    • Update files to support main branch in order to remove oppressive language - #3586
    • Format test code for RedundantSuspendModifierSpec - #3581
    • Gradle tweaks - #3575
    • Support Gradle config cache in detekt's build - #3574
    • Show information from @active in the website - #3569
    • Update rule doc for SwallowedException config - #3547
    • Markdown: Reintroduce double-backticks for inline code rendering - #3545

    See all issues at: 1.17.0

    Source code(tar.gz)
    Source code(zip)
    detekt-cli-1.17.0-RC2-all.jar(54.06 MB)
    detekt-cli-1.17.0-RC2.zip(49.10 MB)
    detekt-formatting-1.17.0-RC2.jar(597.33 KB)
  • v1.17.0-RC1(May 1, 2021)

    1.17.0-RC1 - 2021-05-01

    Notable Changes

    • This release allows you to replace your jcenter() dependencies with mavenCentral() given that our dependency on kotlinx.html migrated to Maven Central - See #3455
    • We now introduced the src/test/java and src/test/kotlin by default for the plain detekt Gradle task. If you use that task, you might notice rule reports in your test sourceset. See #3649
    • We now default the baseline file to baseline.xml so you don't have to specify it manually. You can revert the previous behavior by setting the baseline to null - See #3619
    • We enabled the SARIF output format by default - See #3543
    • We're introducing annotations to provide metadata to rules, such as @ActiveByDefault, @Configuration and @RequiresTypeResolution - See #3637 #3592 and #3579

    Changelog

    • MultilineLambdaItParameter: don't report when lambda has no implicit parameter references - #3696
    • Fix false positives for UnnecessaryFilter - #3695
    • Deprecate configuration of reports in detekt Gradle extension - #3687
    • Ignore actual members in UnusedPrivateMember - #3669
    • NamedArguments rule: fix false positive with trailing lambda - #3661
    • Add DeprecatedBlockTag rule - #3660
    • Noisy gradle - #3655
    • Drop support to Gradle 5 - #3647
    • Add MayBeConstant as alias for MayBeConst - #3644
    • [ThrowingExceptionInMain] [ExitOutsideMainfix] fix for KtNamedFunction.isMainFunction() - #3641
    • Fixing IllegalArgumentException in ForbiddenMethodCall rule for Intersection type parameters - #3626
    • Remove deprecated configurations and deprecate new ones - #3621
    • Replace getJetTypeFqName with fqNameOrNull extension - #3613
    • New Rule: ObjectLiteralToLambda - #3599
    • [MemberNameEqualsClassName] Support factory exemption for generic classes - #3595
    • Refactor Analyzer so that RuleSetProvider.instance is only called once - #3585
    • SarifOutputReportSpec: Correctly detect Windows root directory on local development machine - #3584
    • Replace @since KDoc tag with @SinceDetekt - #3582
    • Simplify code in RedundantSuspendModifier rule - #3580
    • Revert "Refactor Analyzer so that RuleSetProvider.instance is only called once" - #3578
    • fix error message -> buildUponDefaultConfig instead of buildOnDefaultConfig - #3572
    • UnnecessaryApply: fix false positive when lambda has multiple member references - #3564
    • Fix [ClassOrdering] to treat extensions properties as functions. - #3559
    • Switch SARIF report off jackson - #3557
    • Fix rules not appearing in the sarif output - #3556
    • Refactor Analyzer so that RuleSetProvider.instance is only called once - #3555
    • New Rule: DoubleMutabilityForCollection - #3553
    • Adds a ForbiddenSingleExpressionSyntax rule - #3550

    Dependency Updates

    • Upgrade to GitHub-native Dependabot - #3716
    • Upgrade to Gradle 7 - #3689
    • Bump com.gradle.plugin-publish from 0.13.0 to 0.14.0 - #3654
    • Bump kotlin-reflect from 1.4.0 to 1.4.32 - #3627
    • Upgrade to ktlint 0.41.0 - #3624
    • Update to Kotlin 1.4.32 - #3606
    • Bump AGP from 4.1.2 to 4.1.3 - #3589
    • Bump mockk from 1.10.6 to 1.11.0 - #3588

    Housekeeping & Refactorings

    • Remove --stacktrace now that we have scan - #3724
    • Drop JCenter usage from detekt's own build - #3711
    • Publish build scans for all CI builds - #3710
    • Remove deprecated kotlin-dsl Gradle config option - #3709
    • Update to setup-java@v2 - #3704
    • Simplify UpdateVersionInFileTask - #3693
    • Fix compilation issue in :detekt-rules-style:compileTestKotlin - #3691
    • Fix detekt failure in CI - #3674
    • Refactor UnusedPrivateMemberSpec - #3667
    • Warnings as errors - #3646
    • Skip ios tests if no ci - #3635
    • Fix tests - #3634
    • Include detekt-rules on CLI runtime classpath - #3625
    • Improve tests from :detekt-gradle-plugin - #3623
    • Improve generator test coverage - #3622
    • Improve tests - #3618
    • Apply more formatting rules to our code - #3615
    • Add negative test case for requiresTypeResolution - #3614
    • Simplify Gradle config - #3612
    • Decouple Gradle projects - #3611
    • Add --stacktrace to help triage CI flakiness - #3604
    • Fix CI failure for deploy-snapshot - #3598
    • Improve Deprecation and Documentation for allRules - #3596
    • Update files to support main branch in order to remove oppressive language - #3586
    • Format test code for RedundantSuspendModifierSpec - #3581
    • Gradle tweaks - #3575
    • Support Gradle config cache in detekt's build - #3574
    • Show information from @active in the website - #3569
    • Update rule doc for SwallowedException config - #3547
    • Markdown: Reintroduce double-backticks for inline code rendering - #3545

    See all issues at: 1.17.0

    Source code(tar.gz)
    Source code(zip)
    detekt-cli-1.17.0-RC1-all.jar(54.06 MB)
    detekt-cli-1.17.0-RC1.zip(49.10 MB)
    detekt-formatting-1.17.0-RC1.jar(597.33 KB)
  • v1.16.0(Mar 10, 2021)

    • 2021-03-04
    Notable Changes
    Migration
    Changelog
    • Gradle Plugin tests should access also Maven Local - #3510
    • Update Kotlin to version 1.4.31 - #3509
    • Fix SARIF validation failure - #3507
    • Remove off importing android util - #3506
    • Adding support for full method signatures in ForbiddenMethodCall - #3505
    • New rule: disallow to cast to nullable type - #3497
    • Merge XML report output - #3491
    • Allow using regular expressions when defining license header templates - #3486
    • Add UnreachableCatchBlock rule - #3478
    • Add NoNameShadowing rule - #3477
    • Fix false negative "UselessCallOnNotNull" with list.isNullOrEmpty() - #3475
    • Add UseOrEmpty rule - #3470
    • Add UseIsNullOrEmpty rule - #3469
    • Add support to Kotlin Multiplatform Projects - #3453
    • Fix false positives for MultilineLambdaItParameter.kt - #3451
    • Dont generate baseline if empty - #3450
    • Silence IndexOutOfBoundsException in getLineAndColumnInPsiFile() - #3446
    • Add new ObjectExtendsThrowable rule - #3443
    • Add allRules and deprecate failFast in gradle tasks - #3431
    • Add two missing ktlint rules - #3430
    • Don't fail if baseline doesn't exist in PlainDetekt - #3429
    • Fix False Positive on UnnecessarySafeCall - #3419
    • Fix false positive for UnusedPrivateMember with expect on objects - #3417
    • Fix code samples for UnnecessarySafeCall - #3416
    • New rule: DontDowncastCollectionTypes - #3413
    • Fix documentation in UnnecessarySafeCall - #3412
    • Bump gradle from 4.1.1 to 4.1.2 - #3405
    • Introduce --max-issues flag for cli - #2267 - #3391
    • Ignore actual functions in FunctionOnlyReturningConstant (#3388) - #3390
    • Fix hyperlink for elements of the type 'KtFile' - #3386
    • Update gradle doc to show table of contents correctly - #3383
    • Update cli doc to show table of contents correctly - #3382
    • Fix EmptyConfig making all rules active in production - #3380
    • Empty custom config enables rules disabled by default - #3379
    • Add setup-detekt action to README - #3373
    • GlobalClassLoaderCache: move call to getFiles out of synchronized block - #3370
    • Check for === instead of == - #3363
    • Filter existing files in classpath - #3361
    • Suppress RedundantVisibilityModifierRule if explicit API mode enabled - #3358
    • Add the final new line in the baseline again - #3351
    • [Security] Bump nokogiri from 1.10.10 to 1.11.1 in /docs - #3348
    • Remove trailing newline after ending IndentingXMLStreamWriter - #3347
    • [Security] Bump nokogiri from 1.10.10 to 1.11.0 in /docs - #3343
    • Add UnnecessaryFilter rule - #3341
    • Reorganize docs for the configuration file - #3337
    • Add new rule SleepInsteadOfDelay - #3335
    • Update Android Gradle Plugin to 4.1.1 - #3328
    • Support relative output paths - #3319
    • Fix runLastOnRoot being empty in KtLintMultiRule - #3318
    • Ensure binary-compatibility with previous versrions - #3315
    • Fix reports not propagated to detekt task with type resolution - #3313
    • Support configurable severity per ruleset/rule in XML and Sarif output - #3310
    • Configure default excludes for InvalidPackageDeclaration - #3305
    • Remove exceptions of Library rules - #3304
    • Move the questions to discussions - #3300
    • Magic number extension functions - #3299
    • NamedArguments: fix false positive with varargs - #3294
    • NamedArguments rule: false positive with varargs - #3291
    • NamedArguments with java code false positive - #3289
    • Upgrade ktlint to 0.40.0 - #3281
    • False positive "Unconditional loop jump" - #3280
    • ForbiddenComments don't report TODO: in KDoc - #3273
    • Add MultilineLambdaItParameter rule - #3259
    • Update Kotlin to 1.4.21 - #3254
    • Introduce --all-rules flag - #3253
    • Enable more rules by default - #3229
    • Running multiple Detekt tasks concurrently may cause deadlock - #3047
    • detektMain is noisy "Ignoring a file detekt cannot handle" - #3019
    • Configure default excludes for InvalidPackageDeclaration - #2539
    • Hyperlink to error inside Android studio - #2340
    • Align cli flags and defaults with other analysis tools - #2267
    Housekeeping & Refactorings
    • Move gradle testkit test back to test/ - #3504
    • Add documentation on suppressing formatting rules - #3503
    • Change DetektMultiplatform from unit test to gradle testkit integrati… - #3500
    • Bump com.gradle.plugin-publish from 0.12.0 to 0.13.0 - #3494
    • Refactor Gradle integration tests - #3489
    • Refactor gradle integration test - #3487
    • Prepare Detekt 1.16.0-RC2 - #3485
    • Bump mockk from 1.10.5 to 1.10.6 - #3473
    • Upgrade to Gradle 6.8.2 - #3468
    • Correct maxIssues documentation - #3456
    • Bump junit-platform-launcher from 1.7.0 to 1.7.1 - #3454
    • Don't use deprecated functions - #3452
    • Bump github-pages from 210 to 211 in /docs - #3434
    • Add documentation for SARIF, severity and relative path - #3433
    • Refactor uploading SARIF to report without overriding the previous step - #3432
    • Fix githubRelease skipping assets - #3427
    • Prompt bug reporters to attach gradle scan - #3422
    • Fix invalid link in detekt html report - #3421
    • Prepare 1.16.0-rc1 release - #3411
    • Add full qualified name in documentation - #3410
    • Bump kotlinx-coroutines-core from 1.3.8 to 1.4.1 - #3407
    • Fix deploy website on master - #3406
    • Bump mockk from 1.10.4 to 1.10.5 - #3404
    • Bump assertj-core from 3.18.1 to 3.19.0 - #3403
    • Bump github-pages from 209 to 210 in /docs - #3401
    • Update dangling URLs pointing to the old website - #3400
    • Auto generate CLI options in docs - #3399
    • Update documentations on snapshots - #3393
    • Fix maven publish - #3392
    • Fix build script to avoid jvm plugin applied - #3389
    • Disable parallel test discovery; we already use Grade workers for max parallelism - #3387
    • Use more fluent assertions - #3381
    • Refactor orders of repositories - #3376
    • Add a test for UndocumentedPublicClass and fun interfaces - #3374
    • Refactor build.gradle.kts in detekt-gradle-plugin - #3371
    • Gradle to 6.8 - #3362
    • Integrate SARIF report with Github code scanning - #3359
    • Refactor integration test for detekt-gradle-plugin - #3356
    • Improve gradle plugin - #3354
    • Remove checkNotNull - #3352
    • Generate API validation for detekt-psi-utils - #3338
    • recover binary compatibility with 1.15.0 - #3336
    • Refactor tests in detekt-gradle-plugin - #3333
    • Fix failing website deployment on master - #3332
    • The output of updateVersion should not depend on the OS that executes it - #3330
    • Reduce visibility - #3326
    • Refactor XmlOutputFormatSpec - #3325
    • Simplify our buildSrc - #3322
    • Apply binary compatibility plugin to Detekt - #3320
    • Add KDoc for convoluted PathFilters.isIgnored - #3312
    • Don't mix kotlin 1.3 and 1.4 - #3309
    • Allow to overwrite in the task moveJarForIntegrationTest - #3308
    • Remove unnecessary .trimIndent() - housekeeping - #3307
    • Fix typo - #3301
    • General housekeeping - #3298
    • Inline UnconditionalJumpStatementInLoop case files - #3296

    See all issues at: 1.16.0

    Source code(tar.gz)
    Source code(zip)
    detekt-cli-1.16.0-all.jar(53.48 MB)
    detekt-cli-1.16.0.zip(50.45 MB)
    detekt-formatting-1.16.0.jar(561.13 KB)
  • v1.16.0-RC3(Mar 4, 2021)

    • 2021-02-19
    Notable Changes
    Migration
    Changelog
    • Add UnreachableCatchBlock rule - #3478
    • Fix false negative "UselessCallOnNotNull" with list.isNullOrEmpty() - #3475
    • Add UseOrEmpty rule - #3470
    • Add UseIsNullOrEmpty rule - #3469
    • Fix false positives for MultilineLambdaItParameter.kt - #3451
    • Dont generate baseline if empty - #3450
    • Silence IndexOutOfBoundsException in getLineAndColumnInPsiFile() - #3446
    • Add new ObjectExtendsThrowable rule - #3443
    • Add allRules and deprecate failFast in gradle tasks - #3431
    • Add two missing ktlint rules - #3430
    • Don't fail if baseline doesn't exist in PlainDetekt - #3429
    • Fix False Positive on UnnecessarySafeCall - #3419
    • Fix false positive for UnusedPrivateMember with expect on objects - #3417
    • Fix code samples for UnnecessarySafeCall - #3416
    • New rule: DontDowncastCollectionTypes - #3413
    • Fix documentation in UnnecessarySafeCall - #3412
    • Bump gradle from 4.1.1 to 4.1.2 - #3405
    • Introduce --max-issues flag for cli - #2267 - #3391
    • Ignore actual functions in FunctionOnlyReturningConstant (#3388) - #3390
    • Fix hyperlink for elements of the type 'KtFile' - #3386
    • Update gradle doc to show table of contents correctly - #3383
    • Update cli doc to show table of contents correctly - #3382
    • Fix EmptyConfig making all rules active in production - #3380
    • Empty custom config enables rules disabled by default - #3379
    • Add setup-detekt action to README - #3373
    • GlobalClassLoaderCache: move call to getFiles out of synchronized block - #3370
    • Check for === instead of == - #3363
    • Filter existing files in classpath - #3361
    • Suppress RedundantVisibilityModifierRule if explicit API mode enabled - #3358
    • Add the final new line in the baseline again - #3351
    • [Security] Bump nokogiri from 1.10.10 to 1.11.1 in /docs - #3348
    • Remove trailing newline after ending IndentingXMLStreamWriter - #3347
    • [Security] Bump nokogiri from 1.10.10 to 1.11.0 in /docs - #3343
    • Add UnnecessaryFilter rule - #3341
    • Reorganize docs for the configuration file - #3337
    • Add new rule SleepInsteadOfDelay - #3335
    • Update Android Gradle Plugin to 4.1.1 - #3328
    • Support relative output paths - #3319
    • Fix runLastOnRoot being empty in KtLintMultiRule - #3318
    • Ensure binary-compatibility with previous versrions - #3315
    • Fix reports not propagated to detekt task with type resolution - #3313
    • Support configurable severity per ruleset/rule in XML and Sarif output - #3310
    • Configure default excludes for InvalidPackageDeclaration - #3305
    • Remove exceptions of Library rules - #3304
    • Move the questions to discussions - #3300
    • Magic number extension functions - #3299
    • NamedArguments: fix false positive with varargs - #3294
    • NamedArguments rule: false positive with varargs - #3291
    • NamedArguments with java code false positive - #3289
    • Upgrade ktlint to 0.40.0 - #3281
    • False positive "Unconditional loop jump" - #3280
    • ForbiddenComments don't report TODO: in KDoc - #3273
    • Add MultilineLambdaItParameter rule - #3259
    • Update Kotlin to 1.4.21 - #3254
    • Introduce --all-rules flag - #3253
    • Enable more rules by default - #3229
    • Running multiple Detekt tasks concurrently may cause deadlock - #3047
    • detektMain is noisy "Ignoring a file detekt cannot handle" - #3019
    • Configure default excludes for InvalidPackageDeclaration - #2539
    • Hyperlink to error inside Android studio - #2340
    • Align cli flags and defaults with other analysis tools - #2267
    Housekeeping & Refactorings
    • Bump mockk from 1.10.5 to 1.10.6 - #3473
    • Upgrade to Gradle 6.8.2 - #3468
    • Correct maxIssues documentation - #3456
    • Bump junit-platform-launcher from 1.7.0 to 1.7.1 - #3454
    • Don't use deprecated functions - #3452
    • Bump github-pages from 210 to 211 in /docs - #3434
    • Add documentation for SARIF, severity and relative path - #3433
    • Refactor uploading SARIF to report without overriding the previous step - #3432
    • Fix githubRelease skipping assets - #3427
    • Prompt bug reporters to attach gradle scan - #3422
    • Fix invalid link in detekt html report - #3421
    • Prepare 1.16.0-rc1 release - #3411
    • Add full qualified name in documentation - #3410
    • Bump kotlinx-coroutines-core from 1.3.8 to 1.4.1 - #3407
    • Fix deploy website on master - #3406
    • Bump mockk from 1.10.4 to 1.10.5 - #3404
    • Bump assertj-core from 3.18.1 to 3.19.0 - #3403
    • Bump github-pages from 209 to 210 in /docs - #3401
    • Update dangling URLs pointing to the old website - #3400
    • Auto generate CLI options in docs - #3399
    • Update documentations on snapshots - #3393
    • Fix maven publish - #3392
    • Fix build script to avoid jvm plugin applied - #3389
    • Disable parallel test discovery; we already use Grade workers for max parallelism - #3387
    • Use more fluent assertions - #3381
    • Refactor orders of repositories - #3376
    • Add a test for UndocumentedPublicClass and fun interfaces - #3374
    • Refactor build.gradle.kts in detekt-gradle-plugin - #3371
    • Gradle to 6.8 - #3362
    • Integrate SARIF report with Github code scanning - #3359
    • Refactor integration test for detekt-gradle-plugin - #3356
    • Improve gradle plugin - #3354
    • Remove checkNotNull - #3352
    • Generate API validation for detekt-psi-utils - #3338
    • recover binary compatibility with 1.15.0 - #3336
    • Refactor tests in detekt-gradle-plugin - #3333
    • Fix failing website deployment on master - #3332
    • The output of updateVersion should not depend on the OS that executes it - #3330
    • Reduce visibility - #3326
    • Refactor XmlOutputFormatSpec - #3325
    • Simplify our buildSrc - #3322
    • Apply binary compatibility plugin to Detekt - #3320
    • Add KDoc for convoluted PathFilters.isIgnored - #3312
    • Don't mix kotlin 1.3 and 1.4 - #3309
    • Allow to overwrite in the task moveJarForIntegrationTest - #3308
    • Remove unnecessary .trimIndent() - housekeeping - #3307
    • Fix typo - #3301
    • General housekeeping - #3298
    • Inline UnconditionalJumpStatementInLoop case files - #3296

    See all issues at: 1.16.0

    Source code(tar.gz)
    Source code(zip)
    detekt-cli-1.16.0-RC3-all.jar(55.20 MB)
    detekt-cli-1.16.0-RC3.zip(52.07 MB)
    detekt-formatting-1.16.0-RC3.jar(561.32 KB)
  • v1.16.0-RC2(Feb 23, 2021)

    • 2021-02-19
    Notable Changes
    Migration
    Changelog
    • Add UnreachableCatchBlock rule - #3478
    • Fix false negative "UselessCallOnNotNull" with list.isNullOrEmpty() - #3475
    • Add UseOrEmpty rule - #3470
    • Add UseIsNullOrEmpty rule - #3469
    • Fix false positives for MultilineLambdaItParameter.kt - #3451
    • Dont generate baseline if empty - #3450
    • Silence IndexOutOfBoundsException in getLineAndColumnInPsiFile() - #3446
    • Add new ObjectExtendsThrowable rule - #3443
    • Add allRules and deprecate failFast in gradle tasks - #3431
    • Add two missing ktlint rules - #3430
    • Don't fail if baseline doesn't exist in PlainDetekt - #3429
    • Fix False Positive on UnnecessarySafeCall - #3419
    • Fix false positive for UnusedPrivateMember with expect on objects - #3417
    • Fix code samples for UnnecessarySafeCall - #3416
    • New rule: DontDowncastCollectionTypes - #3413
    • Fix documentation in UnnecessarySafeCall - #3412
    • Bump gradle from 4.1.1 to 4.1.2 - #3405
    • Introduce --max-issues flag for cli - #2267 - #3391
    • Ignore actual functions in FunctionOnlyReturningConstant (#3388) - #3390
    • Fix hyperlink for elements of the type 'KtFile' - #3386
    • Update gradle doc to show table of contents correctly - #3383
    • Update cli doc to show table of contents correctly - #3382
    • Fix EmptyConfig making all rules active in production - #3380
    • Empty custom config enables rules disabled by default - #3379
    • Add setup-detekt action to README - #3373
    • GlobalClassLoaderCache: move call to getFiles out of synchronized block - #3370
    • Check for === instead of == - #3363
    • Filter existing files in classpath - #3361
    • Suppress RedundantVisibilityModifierRule if explicit API mode enabled - #3358
    • Add the final new line in the baseline again - #3351
    • [Security] Bump nokogiri from 1.10.10 to 1.11.1 in /docs - #3348
    • Remove trailing newline after ending IndentingXMLStreamWriter - #3347
    • [Security] Bump nokogiri from 1.10.10 to 1.11.0 in /docs - #3343
    • Add UnnecessaryFilter rule - #3341
    • Reorganize docs for the configuration file - #3337
    • Add new rule SleepInsteadOfDelay - #3335
    • Update Android Gradle Plugin to 4.1.1 - #3328
    • Support relative output paths - #3319
    • Fix runLastOnRoot being empty in KtLintMultiRule - #3318
    • Ensure binary-compatibility with previous versrions - #3315
    • Fix reports not propagated to detekt task with type resolution - #3313
    • Support configurable severity per ruleset/rule in XML and Sarif output - #3310
    • Configure default excludes for InvalidPackageDeclaration - #3305
    • Remove exceptions of Library rules - #3304
    • Move the questions to discussions - #3300
    • Magic number extension functions - #3299
    • NamedArguments: fix false positive with varargs - #3294
    • NamedArguments rule: false positive with varargs - #3291
    • NamedArguments with java code false positive - #3289
    • Upgrade ktlint to 0.40.0 - #3281
    • False positive "Unconditional loop jump" - #3280
    • ForbiddenComments don't report TODO: in KDoc - #3273
    • Add MultilineLambdaItParameter rule - #3259
    • Update Kotlin to 1.4.21 - #3254
    • Introduce --all-rules flag - #3253
    • Enable more rules by default - #3229
    • Running multiple Detekt tasks concurrently may cause deadlock - #3047
    • detektMain is noisy "Ignoring a file detekt cannot handle" - #3019
    • Configure default excludes for InvalidPackageDeclaration - #2539
    • Hyperlink to error inside Android studio - #2340
    • Align cli flags and defaults with other analysis tools - #2267
    Housekeeping & Refactorings
    • Bump mockk from 1.10.5 to 1.10.6 - #3473
    • Upgrade to Gradle 6.8.2 - #3468
    • Correct maxIssues documentation - #3456
    • Bump junit-platform-launcher from 1.7.0 to 1.7.1 - #3454
    • Don't use deprecated functions - #3452
    • Bump github-pages from 210 to 211 in /docs - #3434
    • Add documentation for SARIF, severity and relative path - #3433
    • Refactor uploading SARIF to report without overriding the previous step - #3432
    • Fix githubRelease skipping assets - #3427
    • Prompt bug reporters to attach gradle scan - #3422
    • Fix invalid link in detekt html report - #3421
    • Prepare 1.16.0-rc1 release - #3411
    • Add full qualified name in documentation - #3410
    • Bump kotlinx-coroutines-core from 1.3.8 to 1.4.1 - #3407
    • Fix deploy website on master - #3406
    • Bump mockk from 1.10.4 to 1.10.5 - #3404
    • Bump assertj-core from 3.18.1 to 3.19.0 - #3403
    • Bump github-pages from 209 to 210 in /docs - #3401
    • Update dangling URLs pointing to the old website - #3400
    • Auto generate CLI options in docs - #3399
    • Update documentations on snapshots - #3393
    • Fix maven publish - #3392
    • Fix build script to avoid jvm plugin applied - #3389
    • Disable parallel test discovery; we already use Grade workers for max parallelism - #3387
    • Use more fluent assertions - #3381
    • Refactor orders of repositories - #3376
    • Add a test for UndocumentedPublicClass and fun interfaces - #3374
    • Refactor build.gradle.kts in detekt-gradle-plugin - #3371
    • Gradle to 6.8 - #3362
    • Integrate SARIF report with Github code scanning - #3359
    • Refactor integration test for detekt-gradle-plugin - #3356
    • Improve gradle plugin - #3354
    • Remove checkNotNull - #3352
    • Generate API validation for detekt-psi-utils - #3338
    • recover binary compatibility with 1.15.0 - #3336
    • Refactor tests in detekt-gradle-plugin - #3333
    • Fix failing website deployment on master - #3332
    • The output of updateVersion should not depend on the OS that executes it - #3330
    • Reduce visibility - #3326
    • Refactor XmlOutputFormatSpec - #3325
    • Simplify our buildSrc - #3322
    • Apply binary compatibility plugin to Detekt - #3320
    • Add KDoc for convoluted PathFilters.isIgnored - #3312
    • Don't mix kotlin 1.3 and 1.4 - #3309
    • Allow to overwrite in the task moveJarForIntegrationTest - #3308
    • Remove unnecessary .trimIndent() - housekeeping - #3307
    • Fix typo - #3301
    • General housekeeping - #3298
    • Inline UnconditionalJumpStatementInLoop case files - #3296

    See all issues at: 1.16.0

    Source code(tar.gz)
    Source code(zip)
    detekt-cli-1.16.0-RC2-all.jar(53.43 MB)
    detekt-cli-1.16.0-RC2.zip(50.41 MB)
    detekt-formatting-1.16.0-RC2.jar(561.13 KB)
  • v1.16.0-RC1(Jan 26, 2021)

    • 2021-01-26
    Changelog
    • Introduce --max-issues flag for cli - #2267 - #3391
    • Fix hyperlink for elements of the type 'KtFile' - #3386
    • Update gradle doc to show table of contents correctly - #3383
    • Update cli doc to show table of contents correctly - #3382
    • Fix EmptyConfig making all rules active in production - #3380
    • Empty custom config enables rules disabled by default - #3379
    • Add setup-detekt action to README - #3373
    • GlobalClassLoaderCache: move call to getFiles out of synchronized block - #3370
    • Check for === instead of == - #3363
    • Filter existing files in classpath - #3361
    • Suppress RedundantVisibilityModifierRule if explicit API mode enabled - #3358
    • Add the final new line in the baseline again - #3351
    • [Security] Bump nokogiri from 1.10.10 to 1.11.1 in /docs - #3348
    • Remove trailing newline after ending IndentingXMLStreamWriter - #3347
    • [Security] Bump nokogiri from 1.10.10 to 1.11.0 in /docs - #3343
    • Reorganize docs for the configuration file - #3337
    • Add new rule SleepInsteadOfDelay - #3335
    • Update Android Gradle Plugin to 4.1.1 - #3328
    • Support relative output paths - #3319
    • Fix runLastOnRoot being empty in KtLintMultiRule - #3318
    • Ensure binary-compatibility with previous versrions - #3315
    • Fix reports not propagated to detekt task with type resolution - #3313
    • Support configurable severity per ruleset/rule in XML and Sarif output - #3310
    • Configure default excludes for InvalidPackageDeclaration - #3305
    • Remove exceptions of Library rules - #3304
    • Move the questions to discussions - #3300
    • Magic number extension functions - #3299
    • NamedArguments: fix false positive with varargs - #3294
    • NamedArguments rule: false positive with varargs - #3291
    • NamedArguments with java code false positive - #3289
    • Upgrade ktlint to 0.40.0 - #3281
    • False positive "Unconditional loop jump" - #3280
    • ForbiddenComments don't report TODO: in KDoc - #3273
    • Add MultilineLambdaItParameter rule - #3259
    • Update Kotlin to 1.4.21 - #3254
    • Introduce --all-rules flag - #3253
    • Enable more rules by default - #3229
    • Running multiple Detekt tasks concurrently may cause deadlock - #3047
    • detektMain is noisy "Ignoring a file detekt cannot handle" - #3019
    • Configure default excludes for InvalidPackageDeclaration - #2539
    • Hyperlink to error inside Android studio - #2340
    • Align cli flags and defaults with other analysis tools - #2267
    Housekeeping & Refactorings
    • Disable parallel test discovery; we already use Grade workers for max parallelism - #3387
    • Use more fluent assertions - #3381
    • Refactor orders of repositories - #3376
    • Add a test for UndocumentedPublicClass and fun interfaces - #3374
    • Refactor build.gradle.kts in detekt-gradle-plugin - #3371
    • Gradle to 6.8 - #3362
    • Integrate SARIF report with Github code scanning - #3359
    • Refactor integration test for detekt-gradle-plugin - #3356
    • Improve gradle plugin - #3354
    • Remove checkNotNull - #3352
    • Generate API validation for detekt-psi-utils - #3338
    • recover binary compatibility with 1.15.0 - #3336
    • Refactor tests in detekt-gradle-plugin - #3333
    • Fix failing website deployment on master - #3332
    • The output of updateVersion should not depend on the OS that executes it - #3330
    • Reduce visibility - #3326
    • Refactor XmlOutputFormatSpec - #3325
    • Simplify our buildSrc - #3322
    • Apply binary compatibility plugin to Detekt - #3320
    • Add KDoc for convoluted PathFilters.isIgnored - #3312
    • Don't mix kotlin 1.3 and 1.4 - #3309
    • Allow to overwrite in the task moveJarForIntegrationTest - #3308
    • Remove unnecessary .trimIndent() - housekeeping - #3307
    • Fix typo - #3301
    • General housekeeping - #3298
    • Inline UnconditionalJumpStatementInLoop case files - #3296

    See all issues at: 1.16.0

    Source code(tar.gz)
    Source code(zip)
    detekt-cli-1.16.0-RC1-all.jar(53.41 MB)
    detekt-cli-1.16.0-RC1.zip(50.39 MB)
    detekt-formatting-1.16.0-RC1.jar(558.81 KB)
  • v1.15.0(Dec 18, 2020)

    • 2020-12-18
    Notable Changes

    detekt 1.15.0 bundles Kotlin 1.4.10.
    You may experience some known issues when your project already used 1.4.20

    In addition to many rule improvements, there are also new ones:

    • RedundantHigherOrderMapUsage
    • ListAllWhenCases
    • UseIfEmptyOrIfBlank

    We added documentation on how to configure type resolution.
    Only the rules marked with Requires Type Resolution are run ( e.g. https://detekt.github.io/detekt/style.html#forbiddenmethodcall).

    detekt now supports SARIF as an output format. In the future you will be able to upload this format to GitHub and see detekt issues right in your pull requests.

    Migration

    We removed implementations of the Config interface from the public api.
    It was first deprecated and then moved to internal package earlier this year.
    Rule authors can use TestConfig(Map) or yamlConfig(String) from detekt-test to test their rules.

    • Move internal config api to core module - #3163
    Changelog
    • NamedArguments: fix false positive with java method call - #3290
    • Prepare 1.15.0 rc2 - #3286
    • UnconditionalJumpStatementInLoop: don't report a return after a conditional jump
    • Add MuseDev to the list of integrations - #3284
    • Fix ForbiddenComment rule not checking for KDoc - #3275
    • ForbiddenComments don't report TODO: in KDoc - #3273
    • Add IntelliJ platform plugin template integration to readme - #3270
    • Bundle new sarif output format by default - #3268
    • Add a test for UnusedImports with annotations used as attributes #3246
    • Add documentation page on type resolution - #3225
    • ThrowsCount rule: fix false positive with nested function - #3223
    • False positive in ThrowsCount rule - #3222
    • Refactor UnsafeCallOnNullableType rule - #3221
    • Fix false negatives in UnreachableCode rule - #3220
    • False negatives in UnreachableCode rule - #3219
    • Refactor RedundantElseInWhen to use compiler warning - #3214
    • NullableToStringCall: fix false negative with safe qualified expression
    • False negative in NullableToStringCall - #3211
    • NullableToStringCall: fix false negatives with qualified expression
    • False negatives in NullableToStringCall - #3196
    • Check for presence of null case in MissingWhenCase rule - #3194
    • Throw error instead of logging as error in analysis phase - #3193
    • Make kotlinc adapted rule comments internal - #3190
    • MissingWhenCase false negative with nulls - #3189
    • Check for static imports in unused imports rule - #3188
    • Add allowElseExpression configuration for MissingWhenCase rule - #3187
    • Add UseIfEmptyOrIfBlank rule - #3186
    • Fix detektBaseline task filtering .java files - #3185
    • Internal exception should fail the gradle task - #3183
    • Add RedundantHigherOrderMapUsage rule - #3182
    • Fix false negative in IgnoredReturnValue - #3179
    • Fix false positive when to is used to create a pair within a function
    • False Positive PreferToOverPairSyntax - #3177
    • ListAllWhenCases new rule - #3176
    • Suppress RedundantVisibilityModifierRule if explicit API mode enabled
    • Hardcode default values - #3171
    • False negative in IgnoredReturnValue - #3170
    • Fix false positive in IgnoredReturnValue - #3169
    • Duplicate deprecated KtLint methods - #3168
    • Introduce NamedArguments rule - #3167
    • Add JSON Schema documentation - #3166
    • Fix MaxLineLengthSuppressed ignoring @Suppress annotation on class
    • Use the properties syntax in Gradle docs - #3158 - #3161
    • Fix rule LibraryCodeMustSpecifyReturnType - #3155
    • Update README to mention config auto-complete - #3143
    • @Suppress("MaxLineLength") not working for simple block comment inside class
    • Support sarif as a report type - #3045 - #3132
    • UnusedImports false positive for enums in annotation attributes (with type resolution)
    • Unable to generate detektMain baseline for UnsafeCallOnNullableType violations in Android (mixed Kotlin + Java) modules - #3130
    • Suppress RedundantVisibilityModifierRule if explicit API mode enabled
    • SARIF export support - #3045
    • IgnoredReturnValue false positives - #3043
    • Offset calculation in KtLint deprecated/made private - #3021
    • Map { it } must return an error - #2975
    • Upload detekt-formatting plugin to Github releases next to precompiled cli binary
    • Add a rule to flag places where ifBlank and ifEmpty can be used
    • Remove hardcoded default values from rules - #2597
    • Doc: type and symbol solving - #2259
    • Suggestion: LongParameterList rule but on method call if named argument is not used
    Housekeeping & Refactorings
    • Standardize "active" constant - #3292
    • Update Spek to v2.0.15 - #3287
    • Reformat code indentation in ReturnFromFinallySpec.kt - #3278
    • Inline ReturnFromFinally report message text - #3277
    • Simplify ReturnFromFinally check for finally expressions - #3276
    • CI with Java 15 - #3262
    • Enabled publishing of sha256 and sha512 signatures - #3249
    • Remove default config entries in detekt.yml - #3239
    • Fix grammar in configuration guide - #3238
    • Exclude detekt:LargeClass rule in test sources - #3237
    • Release 1.15.0 rc1 - #3236
    • Remove unused format function in RuleExtensions - #3234
    • Update spek to v2.0.14 - #3231
    • Remove already activated rules from detekt.yml - #3230
    • Fix broken website redirects - #3227
    • Remove unused resources from the website - #3226
    • Simplify EqualsOnSignatureLine rule - #3224
    • Remove unnecessary suppression in main - #3217
    • Simplify MissingWhenCase by removing an unnecessary alternative path
    • Refactor HasPlatformType rule - #3210
    • Remove Suppress annotation from ArrayPrimitive - #3209
    • Refactor UselessCallOnNotNull rule - #3208
    • Refactor MissingWhenCase - #3207
    • Refactor NullableToStringCall - #3206
    • Refactor RedundantElseInWhen - #3205
    • Refactor PreferToOverPairSyntax - #3204
    • Remove Suppress annotation from MagicNumber - #3203
    • Remove Suppress annotation from UnusedImports - #3202
    • Refactor FunctionNaming rule - #3201
    • Setup the website publishing pipeline - #3199
    • Improve code coverage for DefaultCliInvoker testing happy and error path
    • Make kotlinc adapted rule comments internal - #3192
    • Improve PreferToOverPairSyntax - #3181
    • Simplify PreferToOverPairSyntax check - #3180
    • Improves in IgnoredReturnValue - #3174
    • Move KtFileContent to FileParsingRule - #3173
    • Don't use deprectad onStart - #3172

    See all issues at: 1.15.0

    Source code(tar.gz)
    Source code(zip)
    detekt(51.15 MB)
    detekt-cli-1.15.0-all.jar(51.15 MB)
    detekt-cli-1.15.0.zip(48.38 MB)
    detekt-formatting-1.15.0.jar(535.76 KB)
  • v1.15.0-RC2(Dec 14, 2020)

    -RC2 - 2020-12-14

    Changelog
    • Fix ForbiddenComment rule not checking for KDoc - #3275
    • ForbiddenComments don't report TODO: in KDoc - #3273
    • Bundle new sarif output format by default - #3268
    • ThrowsCount rule: fix false positive with nested function - #3223
    • False positive in ThrowsCount rule - #3222
    • Refactor UnsafeCallOnNullableType rule - #3221
    • Fix false negatives in UnreachableCode rule - #3220
    • False negatives in UnreachableCode rule - #3219
    • Refactor RedundantElseInWhen to use compiler warning - #3214
    • NullableToStringCall: fix false negative with safe qualified expression - #3213
    • False negative in NullableToStringCall - #3211
    • NullableToStringCall: fix false negatives with qualified expression - #3198
    • False negatives in NullableToStringCall - #3196
    • Check for presence of null case in MissingWhenCase rule - #3194
    • Throw error instead of logging as error in analysis phase - #3193
    • Make kotlinc adapted rule comments internal - #3190
    • MissingWhenCase false negative with nulls - #3189
    • Check for static imports in unused imports rule - #3188
    • Add allowElseExpression configuration for MissingWhenCase rule - #3187
    • Add UseIfEmptyOrIfBlank rule - #3186
    • Fix detektBaseline task filtering .java files - #3185
    • Internal exception should fail the gradle task - #3183
    • Add RedundantHigherOrderMapUsage rule - #3182
    • Fix false negative in IgnoredReturnValue - #3179
    • Fix false positive when to is used to create a pair within a function - #3178
    • False Positive PreferToOverPairSyntax - #3177
    • ListAllWhenCases new rule - #3176
    • Suppress RedundantVisibilityModifierRule if explicit API mode enabled - #3175
    • Hardcode default values - #3171
    • False negative in IgnoredReturnValue - #3170
    • Fix false positive in IgnoredReturnValue - #3169
    • Duplicate deprecated KtLint methods - #3168
    • Introduce NamedArguments rule - #3167
    • Add JSON Schema documentation - #3166
    • Fix MaxLineLengthSuppressed ignoring @Suppress annotation on class - #3164
    • Move internal config api to core module - #3163
    • Use the properties syntax in Gradle docs - #3158 - #3161
    • Fix rule LibraryCodeMustSpecifyReturnType - #3155
    • Update README to mention config auto-complete - #3143
    • @Suppress("MaxLineLength") not working for simple block comment inside class - #3136
    • Support sarif as a report type - #3045 - #3132
    • UnusedImports false positive for enums in annotation attributes (with type resolution) - #3131
    • Unable to generate detektMain baseline for UnsafeCallOnNullableType violations in Android (mixed Kotlin + Java) modules - #3130
    • Suppress RedundantVisibilityModifierRule if explicit API mode enabled - #3125
    • SARIF export support - #3045
    • IgnoredReturnValue false positives - #3043
    • Offset calculation in KtLint deprecated/made private - #3021
    • Map { it } must return an error - #2975
    • Add a rule to flag places where ifBlank and ifEmpty can be used - #2840
    • Remove hardcoded default values from rules - #2597
    • Suggestion: LongParameterList rule but on method call if named argument is not used - #1007
    Housekeeping & Refactorings
    • Reformat code indentation in ReturnFromFinallySpec.kt - #3278
    • Inline ReturnFromFinally report message text - #3277
    • Simplify ReturnFromFinally check for finally expressions - #3276
    • Enabled publishing of sha256 and sha512 signatures - #3249
    • Remove default config entries in detekt.yml - #3239
    • Fix grammar in configuration guide - #3238
    • Exclude detekt:LargeClass rule in test sources - #3237
    • Release 1.15.0 rc1 - #3236
    • Remove unused format function in RuleExtensions - #3234
    • Update spek to v2.0.14 - #3231
    • Remove already activated rules from detekt.yml - #3230
    • Fix broken website redirects - #3227
    • Remove unused resources from the website - #3226
    • Simplify EqualsOnSignatureLine rule - #3224
    • Remove unnecessary suppression in main - #3217
    • Simplify MissingWhenCase by removing an unnecessary alternative path - #3216
    • Refactor HasPlatformType rule - #3210
    • Remove Suppress annotation from ArrayPrimitive - #3209
    • Refactor UselessCallOnNotNull rule - #3208
    • Refactor MissingWhenCase - #3207
    • Refactor NullableToStringCall - #3206
    • Refactor RedundantElseInWhen - #3205
    • Refactor PreferToOverPairSyntax - #3204
    • Remove Suppress annotation from MagicNumber - #3203
    • Remove Suppress annotation from UnusedImports - #3202
    • Refactor FunctionNaming rule - #3201
    • Setup the website publishing pipeline - #3199
    • Improve code coverage for DefaultCliInvoker testing happy and error path - #3195
    • Make kotlinc adapted rule comments internal - #3192
    • Improve PreferToOverPairSyntax - #3181
    • Simplify PreferToOverPairSyntax check - #3180
    • Improves in IgnoredReturnValue - #3174
    • Move KtFileContent to FileParsingRule - #3173
    • Don't use deprectad onStart - #3172

    See all issues at: 1.15.0

    Source code(tar.gz)
    Source code(zip)
    detekt(51.15 MB)
    detekt-cli-1.15.0-RC2-all.jar(51.15 MB)
    detekt-cli-1.15.0-RC2.zip(48.38 MB)
    detekt-formatting-1.15.0-RC2.jar(535.76 KB)
  • v1.15.0-RC1(Nov 16, 2020)

    -RC1 - 2020-11-16

    Changelog
    • ThrowsCount rule: fix false positive with nested function - #3223
    • False positive in ThrowsCount rule - #3222
    • Refactor UnsafeCallOnNullableType rule - #3221
    • Fix false negatives in UnreachableCode rule - #3220
    • False negatives in UnreachableCode rule - #3219
    • Refactor RedundantElseInWhen to use compiler warning - #3214
    • NullableToStringCall: fix false negative with safe qualified expression - #3213
    • False negative in NullableToStringCall - #3211
    • NullableToStringCall: fix false negatives with qualified expression - #3198
    • False negatives in NullableToStringCall - #3196
    • Check for presence of null case in MissingWhenCase rule - #3194
    • Throw error instead of logging as error in analysis phase - #3193
    • Make kotlinc adapted rule comments internal - #3190
    • MissingWhenCase false negative with nulls - #3189
    • Check for static imports in unused imports rule - #3188
    • Add allowElseExpression configuration for MissingWhenCase rule - #3187
    • Add UseIfEmptyOrIfBlank rule - #3186
    • Fix detektBaseline task filtering .java files - #3185
    • Internal exception should fail the gradle task - #3183
    • Add RedundantHigherOrderMapUsage rule - #3182
    • Fix false negative in IgnoredReturnValue - #3179
    • Fix false positive when to is used to create a pair within a function - #3178
    • False Positive PreferToOverPairSyntax - #3177
    • ListAllWhenCases new rule - #3176
    • Suppress RedundantVisibilityModifierRule if explicit API mode enabled - #3175
    • Hardcode default values - #3171
    • False negative in IgnoredReturnValue - #3170
    • Fix false positive in IgnoredReturnValue - #3169
    • Duplicate deprecated KtLint methods - #3168
    • Introduce NamedArguments rule - #3167
    • Add JSON Schema documentation - #3166
    • Fix MaxLineLengthSuppressed ignoring @Suppress annotation on class - #3164
    • Move internal config api to core module - #3163
    • Use the properties syntax in Gradle docs - #3158 - #3161
    • Fix rule LibraryCodeMustSpecifyReturnType - #3155
    • Update README to mention config auto-complete - #3143
    • @Suppress("MaxLineLength") not working for simple block comment inside class - #3136
    • Support sarif as a report type - #3045 - #3132
    • UnusedImports false positive for enums in annotation attributes (with type resolution) - #3131
    • Unable to generate detektMain baseline for UnsafeCallOnNullableType violations in Android (mixed Kotlin + Java) modules - #3130
    • Suppress RedundantVisibilityModifierRule if explicit API mode enabled - #3125
    • SARIF export support - #3045
    • IgnoredReturnValue false positives - #3043
    • Offset calculation in KtLint deprecated/made private - #3021
    • Map { it } must return an error - #2975
    • Add a rule to flag places where ifBlank and ifEmpty can be used - #2840
    • Remove hardcoded default values from rules - #2597
    • Suggestion: LongParameterList rule but on method call if named argument is not used - #1007
    Housekeeping & Refactorings
    • Remove unused format function in RuleExtensions - #3234
    • Update spek to v2.0.14 - #3231
    • Remove already activated rules from detekt.yml - #3230
    • Fix broken website redirects - #3227
    • Remove unused resources from the website - #3226
    • Simplify EqualsOnSignatureLine rule - #3224
    • Remove unnecessary suppression in main - #3217
    • Simplify MissingWhenCase by removing an unnecessary alternative path - #3216
    • Refactor HasPlatformType rule - #3210
    • Remove Suppress annotation from ArrayPrimitive - #3209
    • Refactor UselessCallOnNotNull rule - #3208
    • Refactor MissingWhenCase - #3207
    • Refactor NullableToStringCall - #3206
    • Refactor RedundantElseInWhen - #3205
    • Refactor PreferToOverPairSyntax - #3204
    • Remove Suppress annotation from MagicNumber - #3203
    • Remove Suppress annotation from UnusedImports - #3202
    • Refactor FunctionNaming rule - #3201
    • Setup the website publishing pipeline - #3199
    • Improve code coverage for DefaultCliInvoker testing happy and error path - #3195
    • Make kotlinc adapted rule comments internal - #3192
    • Improve PreferToOverPairSyntax - #3181
    • Simplify PreferToOverPairSyntax check - #3180
    • Improves in IgnoredReturnValue - #3174
    • Move KtFileContent to FileParsingRule - #3173
    • Don't use deprectad onStart - #3172

    See all issues at: 1.15.0

    Source code(tar.gz)
    Source code(zip)
    detekt(49.09 MB)
    detekt-cli-1.15.0-RC1-all.jar(49.09 MB)
    detekt-cli-1.15.0-RC1.zip(44.55 MB)
Owner
Static code analysis for Kotlin
null
Yet another static code analyzer for malicious Android applications

Androwarn Yet another static code analyzer for malicious Android applications Description Androwarn is a tool whose main aim is to detect and warn the

Thomas D. 422 Dec 28, 2022
ArchGuard is a architecture governance tool which can analysis architecture in container, component, code level, create architecure fitness functions, and anaysis system dependencies..

ArchGuard backend ArchGuard is a architecture governance tool which can analysis architecture in container, component, code level, database, create ar

ArchGuard 446 Dec 20, 2022
Static recyclerview dan kalkulator sederhana, dibuat dengan menggunakan kotlin

Static Recyclerview Using Kotlin Static recyclerview dan kalkulator sederhana, dibuat dengan menggunakan kotlin. Screenshot License Copyright (C) 2021

AR Hakim 2 Dec 14, 2021
FlowDroid Static Data Flow Tracker

FlowDroid Data Flow Analysis Tool This repository hosts the FlowDroid data flow analysis tool. FlowDroid statically computes data flows in Android app

Secure Software Engineering Group at Paderborn University and Fraunhofer IEM 801 Dec 28, 2022
Veyron - Covid 19 analysis using OWID data

veyron Covid 19 & Vaccine history representation by country. The app was designe

Nino Matassa 0 Feb 10, 2022
Mole Analysis Use Case for HMS ML Kit Custom Model

Mole Analysis Mole Analysis Use Case for HMS ML Kit Custom Model Introduction What is Melanoma? Melanoma is the most serious among skin cancers becaus

null 15 Aug 23, 2022
Android Package Inspector - dynamic analysis with api hooks, start unexported activities and more. (Xposed Module)

Inspeckage - Android Package Inspector Inspeckage is a tool developed to offer dynamic analysis of Android applications. By applying hooks to function

acpm 2.5k Jan 8, 2023
A collection of custom Android/Kotlin lint checks we use in our Android and Kotlin code bases at Slack.

slack-lints This repository contains a collection of custom Android/Kotlin lint checks we use in our Android and Kotlin code bases at Slack. This repo

Slack 119 Dec 20, 2022
Solution to the 2021 Advent of code challenge in Kotlin. aoc-2021-in-kotlin

advent-of-code-2021 Welcome to the Advent of Code1 Kotlin project created by aniobistanley using the Advent of Code Kotlin Template delivered by JetBr

null 0 Dec 24, 2021
BuildConfiguration information for use in multi-module, or Kotlin Multiplatform common code

component-build-configuration A small library supporting Kotlin Multiplatform for utilizing BuildConfiguration details from common code and across mod

Matthew Nelson 2 Mar 6, 2022
Advent of Code template project for Kotlin

Advent of Code Kotlin Template Advent of Code – an annual event in December since 2015. Every year since then, with the first day of December, a progr

Kotlin Hands-On Labs 336 Dec 23, 2022
My Advent of Code solutions written in Kotlin

AOC21 My Advent of Code solutions written in Kotlin Why Kotlin? I think Kotlin is a really suitable language for Advent of Code, because it handles li

Chris 2 Dec 14, 2021
My solutions for Advent of Code 2021 puzzles, mainly using Kotlin.

Advent of Code 2021 Featuring Kotlin What's that ? https://adventofcode.com/2021/about Advent of Code is an Advent calendar of small programming puzzl

Petrole 0 Dec 2, 2021
My solutions for Advent of Code 2021, written in Kotlin!

Advent-of-Code-2021 Welcome to the Advent of Code1 Kotlin project created by thijsboehme using the Advent of Code Kotlin Template delivered by JetBrai

Thijs Boehme 0 Dec 15, 2021
Kotlin fun with Advent of Code 2021

aoc-kotlin Welcome to the Advent of Code1 Kotlin project created by dayanruben using the Advent of Code Kotlin Template delivered by JetBrains. In thi

Dayan Ruben Gonzalez 32 Dec 15, 2022
Advent of Code 2021 implementations in Kotlin

advent-of-code-in-kotlin-2021 Welcome to the Advent of Code1 Kotlin project created by acrane13 using the Advent of Code Kotlin Template delivered by

null 0 Dec 20, 2021
Advent of Code 2021: Solutions in Kotlin

Advent of Code 2021 Solutions in Kotlin This repo is my personal attempt at solving the Advent of Code 2021 set of problems with the Kotlin programmin

Todd Ginsberg 33 Nov 28, 2022
Advent of Code 2021, using Kotlin

Advent of Code 2021, using Kotlin See https://adventofcode.com/2021, https://kotlinlang.org/. See also "the official GitHub template" by JetBrains. Ge

Stefan Scheidt 3 Nov 18, 2022
Advent of Code 2020 - Kotlin

* , _/^\_ < > * /.-.\ * * `/&\` *

Mateo Bošnjak 2 Dec 1, 2022