Skip to content

Upgrade to Detekt 2.0.0-alpha.2 with analysis_mode and fail_on_severity attrs - #209

Open
ryanulep wants to merge 2 commits into
buildfoundation:masterfrom
ryanulep:v2
Open

Upgrade to Detekt 2.0.0-alpha.2 with analysis_mode and fail_on_severity attrs#209
ryanulep wants to merge 2 commits into
buildfoundation:masterfrom
ryanulep:v2

Conversation

@ryanulep

Copy link
Copy Markdown
Contributor

Upgrades the default Detekt version from 1.23.8 to 2.0.0-alpha.2, adapting to the new Detekt 2.x API and CLI changes.

Changes

  • Default Detekt version: 1.23.82.0.0-alpha.2
  • Java package: io.gitlab.arturbosch.detektdev.detekt
  • analysis_mode attr (replaces enable_type_resolution): "light" (default, syntax-only) or "full" (type resolution with classpath)
  • fail_on_severity attr: controls minimum severity that fails the build ("Error" default, or "Warning", "Info", "Never")
  • Console output: findings now use Detekt's built-in markdown console reporter instead of a text report file; txt_report attr removed
  • Toolchain: default language_version updated to 2.3; jvm_target now supports values up to 24
  • README: updated compatibility matrix to include v1.0-alpha.2 row; improved documentation throughout

Breaking Changes

  • enable_type_resolution attr removed — use analysis_mode = "full" instead
  • max_issues attr removed — use fail_on_severity instead
  • txt_report attr removed — text report output is no longer supported by Detekt 2.x
  • Not compatible with Detekt 1.x; use v0.8.x for Detekt 1.x support

Comment thread .claude/settings.local.json Outdated
package io.buildfoundation.bazel.detekt.execute;

import io.gitlab.arturbosch.detekt.cli.CliRunner;
import dev.detekt.cli.CliRunner;

@Bencodes Bencodes Mar 12, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the package name change here? Maybe unlikely but this could break people that are depending on this via the compiled jar in their own binary target.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Detekt v2 changed the namespace so it has to be updated here to invoke the CLI. Otherwise, there's an error when invoking the rule that io.gitlab.arturbosch.detekt.cli.CliRunner does not exist.

@ryanulep
ryanulep force-pushed the v2 branch 3 times, most recently from d9dd940 to 607945a Compare March 16, 2026 13:56
@everag

everag commented Aug 17, 2026

Copy link
Copy Markdown

@ryanulep any updates on this? I've been following this PR in hopes to introduce detekt to a JDK 25 based codebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants