https://kotlinlang.org logo
Join Slack
Powered by
# detekt
  • s

    seb

    09/04/2025, 5:16 PM
    @gammax looks like auto-fix is broken, at least in the IDE plugin: https://github.com/detekt/detekt-intellij-plugin/issues/533
  • g

    gammax

    09/04/2025, 5:20 PM
    I don’t have much context on the IdE plugin sadly
  • s

    seb

    09/04/2025, 5:36 PM
    I may be one of the biggest contributors lol
    ❤️ 2
  • s

    seb

    09/04/2025, 5:36 PM
    I need to check if the Gradle plugin actually does auto-fix
  • s

    seb

    09/04/2025, 5:36 PM
    Or if the auto-fix mechanism is completely broken
  • s

    seb

    09/04/2025, 6:02 PM
    Looks like setting
    detekt.autoCorrect
    in Gradle also doesn't do auto-correct when I run
    :detekt
    . Is there some other thing I need to do to enable auto-correct for the rule?
    a
    • 2
    • 2
  • e

    eygraber

    09/04/2025, 7:09 PM
    I'm seeing a few instances of this in the logs when running detekt 2.0.0-alpha.0
    There were 11 compiler errors found during legacy compiler analysis. This affects accuracy of reporting.
    Do I need to use the compiler plugin to resolve those?
    b
    • 2
    • 2
  • g

    gammax

    09/04/2025, 7:10 PM
    Please report an issue for both folks
  • n

    Nicholas Doglio

    09/04/2025, 7:13 PM
    Is there going to be a migration guide? Parsing the changelog now and I think I'm able to find what I need but as more things changes having a central concise list changes to make would be helpful 🙌
    b
    e
    g
    • 4
    • 5
  • g

    Gama11

    09/05/2025, 8:29 AM
    is the alpha only available as a github release for now? can't seem to find it in maven central / gradle plugin portal
    h
    g
    • 3
    • 4
  • g

    Gama11

    09/05/2025, 9:18 AM
    testing the alpha against our project right now. seems to be extremely slow, taking over 15 minutes for some modules already. is there by chance a way to output time spent per rule or something like that to narrow down the reason?
    g
    b
    a
    • 4
    • 9
  • b

    Brais Gabin

    09/05/2025, 10:12 AM
    I'm working on the migration guide. It is still a Draft-PR but maybe it help someone: https://github.com/detekt/detekt/pull/8610 Right now it's only for rule authors. I hope to have something for the users today too. Any feedback is more than welcome.
    ❤️ 3
  • j

    Joe

    09/05/2025, 10:45 PM
    I may be missing something in the migration (changed version, detekt-cli's maven groupId, and Main class package coordinate) but getting this when I try updating to 2.0.0-alpha.0 using antrun maven plugin (looks like there's a 0-all.jar, but not a 0.jar for both of these?):
    Copy code
    Downloading from central: <https://repo.maven.apache.org/maven2/dev/detekt/detekt-kotlin-analysis-api/2.0.0-alpha.0/detekt-kotlin-analysis-api-2.0.0-alpha.0.jar>
    Downloading from central: <https://repo.maven.apache.org/maven2/dev/detekt/detekt-kotlin-analysis-api-standalone/2.0.0-alpha.0/detekt-kotlin-analysis-api-standalone-2.0.0-alpha.0.jar>
     [.... snip reactor summary ...]
    Execution detekt of goal org.apache.maven.plugins:maven-antrun-plugin:3.1.0:run failed: Plugin org.apache.maven.plugins:maven-antrun-plugin:3.1.0 or one of its dependencies could not be resolved: The following artifacts could not be resolved: dev.detekt:detekt-kotlin-analysis-api:jar:2.0.0-alpha.0 (absent), dev.detekt:detekt-kotlin-analysis-api-standalone:jar:2.0.0-alpha.0 (absent): Could not find artifact dev.detekt:detekt-kotlin-analysis-api:jar:2.0.0-alpha.0 in central (<https://repo.maven.apache.org/maven2>)
    ➕ 1
  • u

    ursus

    09/05/2025, 11:39 PM
    Does the new 2.0 mean that type resolution is always on, i.e. there is distinction between the rules anymore?
    b
    n
    • 3
    • 5
  • r

    Ryan Ulep

    09/08/2025, 1:02 PM
    The new
    detekt-compiler-plugin
    should work with Kotlin 2.+ correct? I'm getting:
    Copy code
    error: there are some plugins incompatible with language version 2.0:
      io.github.detekt.compiler.plugin.DetektCompilerPluginRegistrar
    Please use language version 1.9 or below
    g
    b
    k
    • 4
    • 10
  • u

    ursus

    09/11/2025, 7:41 PM
    How do I create the most light task that has
    type resolution
    enabled? If I run
    detektMain
    I'm getting both debug & release. Is that normal? (and release stuff takes way longer)
    a
    b
    • 3
    • 5
  • u

    ursus

    09/12/2025, 5:13 PM
    I have a sort of DSLy interface with many implementations where
    CognitiveComplexMethod
    blows up. Is there a global way to have implementations of such interface to not be analyzed?
    b
    • 2
    • 2
  • e

    Eduard Boloș

    09/26/2025, 2:09 PM
    Hello! I am giving version 2.0.0-alpha.0 a try, and I ran into a problem caused by what I believe to be how I use
    ReportMergeTask
    . In v1, it looks like the Detekt tasks were created only for the variants that were not being filtered out. But now in v2 they are created for all the variants, but only the ones that are not filtered out are linked to the main task as a dependency. However, that means that the merge task, when configured similar to these docs, it will trigger all the registered tasks, although some of them should ignored. I will post my configuration in the thread below, for more clarity. But the question is: am I supposed to do something differently now?
    • 1
    • 4
  • e

    Eduard Boloș

    09/29/2025, 10:06 AM
    Related to v2 again, I am getting a
    NoSuchMethodError
    error in the unit tests when calling
    lintWithContext
    on a rule (stacktrace in thread 🧵). I think it's something due to dependencies, I updated Kotlin to version 2.2.20, but maybe something is missing. Update: downgrading to Kotlin 2.2.10 seems to have fixed the issue.
    ✅ 1
    • 1
    • 2
  • s

    stuebingerb

    09/30/2025, 11:28 AM
    Hi, currently detekt (1.23.8) fails when running with Java 25. Are there plans to support this, or is there anything I can do except for downgrading my local JVM?
    b
    • 2
    • 3
  • e

    eygraber

    10/05/2025, 7:29 PM
    Is there a schedule for the v2 alphas, or is it milestone based?
    g
    • 2
    • 7
  • m

    MIDI

    10/10/2025, 10:25 AM
    Hi all! I am using the Arrow library at work, and am utilizing the arrow-detekt-rules to catch missing
    bind()
    calls. It works fine when running with Gradle, but IntelliJ does not highlight according to this rule, even though I downloaded the arrow-detekt-rules JAR from Maven Repository, placed it in my home folder and pointed to it in the IntelliJ Detekt Plugin settings. Does anyone have experience with this issue or a thought about what might be wrong? Thanks a lot!
    p
    • 2
    • 2
  • u

    ursus

    10/13/2025, 12:41 PM
    Hey I'm looking at the compatibility table (https://detekt.dev/docs/introduction/compatibility/) I'm at the latest stable
    1.23.8
    and kotlin
    2.2.20
    & agp
    8.13.0
    (basically all latest stable stuff) and everything works fine is this not expected? looking at the table I was expecting too need to use the
    2.0.0-alpha.0
    b
    • 2
    • 3
  • g

    Gama11

    10/22/2025, 3:04 PM
    Trying
    2.0.0-alpha.1
    , I'm seeing a bunch of errors related to explicit calls to
    .serializer()
    methods of
    @Serializable
    classes. Is there a way to tell detekt to use the kotlinx-serialization compiler plugin when invoking the compiler? Or do these errors not matter anyway?
    Copy code
    error: unresolved reference 'serializer'.
        valueCodec = JsonCodec(ClassName.serializer()),
                                         ^^^^^^^^^^
    • 1
    • 1
  • e

    eygraber

    10/22/2025, 5:23 PM
    In v1.x are rules like
    CastNullableToNonNullableType
    supposed to see a Java method annotated with
    org.jspecify.annotations.NonNull
    as non-null?
    a
    • 2
    • 2
  • j

    jbarr

    10/27/2025, 9:37 PM
    when I upgraded our monorepo to Kotlin 2.2.0, i saw lots of invalid Detekt issues when using Detekt 1.x. are there plans for a Kotlin 2.2.0/2.2.20 based-1.x release while Detekt 2.x soaks in pre-release? (if not, i can use a local fork)
    b
    u
    • 3
    • 3
  • d

    Denys

    10/29/2025, 6:44 PM
    Can you tell me what the problem might be?
    Execution failed for task ':detekt'.
    > java.lang.IllegalStateException: Analyzing ExampleInstrumentedTest.kt led to an exception.
    Location: java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315)
    The original exception message was: java.lang.NullPointerException: Parameter specified as non-null is null: method kotlin.text.StringsKt__StringsKt.removePrefix, parameter <this>
    s
    • 2
    • 1
  • f

    Fredrik Meyer

    11/10/2025, 9:12 AM
    Is there a way to either get
    ./gradlew detekt
    to use type resolution or make
    ./gradlew detektMain
    generate a sarif report (for Github)?
    b
    • 2
    • 2
  • e

    eygraber

    11/18/2025, 5:49 PM
    I'm not sure if this is an issue on Kotlin's side or Detekt's, but Detekt 1.23.8 has a ton of false positives across many rules when used with Kotlin 2.3.0-RC.
    a
    h
    • 3
    • 5
  • m

    Michael Krussel

    11/18/2025, 10:36 PM
    How do you get detekt to find problems requiring type resolution in the
    commonMain
    source set? I had been using
    detekt.multiplatform.disabled=false
    because of this long ago, but the code I wrote to build the detekt tasks are using deprecated calls when trying to upgrade Kotlin, so I thought I would try the built in one instead. The documentation says
    detektMetadataCommonMain
    - Runs detekt with type resolution on the
    common
    module in the
    main
    source set
    So I thought that would pick up errors in
    commonMain
    , but I did a
    !!
    call that was not reported. If I do that in
    androidMain
    the android task picks it up. The only configuration I'm doing is
    Copy code
    detekt {
        buildUponDefaultConfig = true
        config = files("${project.rootDir}/quality/detekt/detekt-config.yml")
    }
    This is with Kotlin 2.1.21 and detekt 1.23.8 and gradle 8.11.1.