Repository navigation
Conversation
The test tasks registered by the version-compatibility plugin (testCompatKtLint1Dot0Dot0, testCompatCleanthat2Dot1, ...) never called useJUnitPlatform(), so they discovered none of the JUnit 5 adapter tests. Together with failOnNoDiscoveredTests = false this went unnoticed and the adapter tests have silently been skipped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MTr23vEiR4QymHV1bKhe6h
ktlint 2.x is published under the new Maven group io.github.ktlint.core and moved its packages from com.pinterest.ktlint to io.github.ktlint.core, so changing the coordinate alone is not enough (diffplug#3156): - KtLintStep resolves io.github.ktlint.core:ktlint-cli for versions >= 2. - New KtLintCompat2Dot0Dot0Adapter built against the 2.x API (RuleSetV2Provider/RuleV2Provider, new KtLintRuleEngine constructor and format(...) signature). KtlintFormatterFunc dispatches to it for major versions >= 2. - ktlint 2.x asks for the autocorrect decision while a rule is executing and wraps exceptions thrown there, so uncorrectable violations are collected and reported as a Spotless lint after formatting finished. - Like for 1.x, ktlint_code_style defaults to intellij_idea when overrides are given but no code style is configured. The caller's override map is no longer mutated. The default ktlint version stays 1.8.0 as 2.x is still in alpha. Custom rule sets written for ktlint 1.x are not supported on 2.x: since 2.0.0-ALPHA-5 ktlint uses the Kotlin Analysis API (com.intellij.*) instead of kotlin-compiler-embeddable (org.jetbrains.kotlin.com.intellij.*), so 1.x rules no longer override the visitor methods of the backward compatibility module. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MTr23vEiR4QymHV1bKhe6h
Pankraz76
marked this pull request as ready for review
November 23, 2026 19:04
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #3156.
Note
Stacked on #3206 (first commit), so the new adapter tests actually run. Kept as a draft while ktlint 2.x is in alpha; see "Open points".
ktlint 2.x is published under
io.github.ktlint.coreand moved its packages fromcom.pinterest.ktlinttoio.github.ktlint.core. Changing the Maven coordinate alone is therefore not enough: the glue code is compiled against the 1.x API.Changes
KtLintStepresolvesio.github.ktlint.core:ktlint-clifor versions >= 2. The 0.x and 1.x paths are unchanged.KtLintCompat2Dot0Dot0Adapteragainst the 2.x API:RuleSetV2Provider/RuleV2Provider, the newKtLintRuleEngineconstructor and the newformat(...)signature.KtlintFormatterFuncdispatches to it for major >= 2, following the same pattern as the diktat glue.RuleExecutionException. Uncorrectable violations are therefore collected and reported as a SpotlessLintonce formatting has finished.ktlint_code_styledefaults tointellij_ideawhen overrides are set but no code style is configured. The caller's override map is no longer mutated.1.8.0.Tests
KtLintCompat2Dot0Dot0AdapterTest: defaults, an editorconfig override disabling a rule, and an unfixable violation reported with line and rule id.KtLintStepTest.works2_0_0: end-to-end format and lint with2.0.0-ALPHA-5.:testlib:test --tests 'com.diffplug.spotless.kotlin.*'(24 tests),spotlessCheck,changelogCheck, and SpotBugs for main, ktlint and both compat source sets.Open points
2.0.0-ALPHA-4→ALPHA-5changed exactly theKtLintRuleEngineconstructor andformat(...)signatures this adapter uses, so it only works with ALPHA-5+. It may be better to merge once 2.0.0 final is out.com.intellij.*) instead ofkotlin-compiler-embeddable(org.jetbrains.kotlin.com.intellij.*). Rules likeio.nlopez.compose.rules:ktlint:0.4.25load throughktlint-com-pinterest-backward-compatibility, but theirbeforeVisitChildNodes(org.jetbrains.kotlin.com.intellij.lang.ASTNode, …)no longer overrides the compatRule, so they silently never fire. I verified this with a spike and left it out; it's documented in CHANGES. Should Spotless warn when only a 1.x rule set (RuleSetProviderV3) is found on ktlint 2.x?no-semi→semicolon, so existingeditorConfigOverridekeys can silently stop matching. This is noted in CHANGES.🤖 Generated with Claude Code
https://claude.ai/code/session_01MTr23vEiR4QymHV1bKhe6h