Skip to content

Kotlin formatting via ktfmt; bump scalafmt + GJF defaults#595

Merged
oyvindberg merged 3 commits into
masterfrom
formatting
May 26, 2026
Merged

Kotlin formatting via ktfmt; bump scalafmt + GJF defaults#595
oyvindberg merged 3 commits into
masterfrom
formatting

Conversation

@oyvindberg
Copy link
Copy Markdown
Owner

Summary

  • `bleep fmt` now also formats Kotlin via ktfmt 0.62 (JAR from Maven Central), driven by an optional `.kotlinfmt.conf` HOCON sidecar (mirrors the existing `.javafmt.conf` pattern, since ktfmt — like google-java-format — has no native config file). Default style is `kotlinlang`; `google` and `meta` are available.
  • Bumped encoded default versions to the current latest stable: scalafmt `3.5.9` → `3.11.1`, google-java-format `1.33.0` → `1.35.0`. The previous `1.33.0` default did not exist when shipped; today it's just stale.
  • Per-language download gate already existed; this PR keeps it intact for Kotlin and adds a test asserting that a kotlin-only project does not auto-create `.scalafmt.conf` (the unmistakable signature of scalafmt having run).
  • Fixed long-standing path bug in `KotlinIT` and `SymbolProcessorResolverTest`: files were written under `src/main/kotlin/` / `src/test/kotlin/` but bleep's default kotlin layout resolves to `src/kotlin/` (sbt-scope defaults to `""`). The kotlin sources were never being compiled — the `KotlinIT` suite was a 4-test silent no-op. After the fix, runtime jumps 1s → 27s because kotlinc and JUnit now actually run.

Test plan

  • `bleep fmt --check` is clean
  • `KotlinFmtTest`, `JavaFmtTest`, `ScalafmtTest` unit tests all pass (18 total)
  • New `FmtIT` (4 integration tests) passes — each language is exercised end-to-end against a fresh workspace, plus a selectivity check
  • `KotlinIT` (4 tests) still passes — now actually compiles kotlin and runs JUnit
  • `SymbolProcessorResolverTest` still passes after path normalization

🤖 Generated with Claude Code

…aults

bleep fmt gains a third language branch backed by ktfmt 0.62, fetched from
Maven Central. Config lives in an optional .kotlinfmt.conf (HOCON), mirroring
.javafmt.conf — both tools have no native config of their own. Default style
is kotlinlang (Kotlin coding conventions); google and meta are also available.

Default versions bumped: scalafmt 3.5.9 → 3.11.1, google-java-format
1.33.0 → 1.35.0 (the 1.33.0 default would have 404'd until 2025-12 and is no
longer current anyway).

New FmtIT integration test exercises all three formatters end-to-end and
verifies the per-language gate: a kotlin-only project does not create a
.scalafmt.conf, proving scalafmt is never invoked.

Fixes existing KotlinIT and SymbolProcessorResolverTest paths that wrote to
src/main/kotlin/ and src/test/kotlin/. Bleep's default kotlin layout resolves
to src/kotlin/ (sbt-scope defaults to ""), so the kotlin sources were never
picked up — the suite was passing as a 4-test silent no-op. After the fix, the
suite actually compiles kotlin and runs JUnit tests (runtime 1s → 27s).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
oyvindberg and others added 2 commits May 26, 2026 09:32
The new ktfmt branch in bleep fmt rightfully flagged these two existing .kt
files since nothing had ever run a formatter over them. CI failure was a
correctness signal, not a regression — apply the formatter so fmt --check
passes on master once this lands.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Test runners (ScalaJsTestRunner, KotlinTestRunner.Js) and the BSP
servers that drive them no longer assume `node` is on PATH; they take
the node binary as a parameter and the BSP server resolves it via
FetchNode using the project's jsNodeVersion (or constants.Node).

SnapshotTest's cross-process GitLock now resolves .git correctly inside
git worktrees and lives in the per-worktree git dir so concurrent test
runs in different worktrees of the same repo no longer block each
other.

cli.scala now includes captured stderr in the exception message, so
SnapshotTest's `index.lock`-retry actually triggers (it was matching
the empty hand-crafted message before) and any failing subprocess gets
a useful error instead of bare "exit code N".

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@oyvindberg oyvindberg merged commit b848285 into master May 26, 2026
10 checks passed
@oyvindberg oyvindberg deleted the formatting branch May 26, 2026 23:05
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.

1 participant