Subsystem · formatter

Formatter

curie fmt formats both Java and Kotlin sources in one command — palantir-java-format for Java and ktfmt for Kotlin. Neither tool needs a separate install.

What it runs

Both formatters are resolved from Maven Central on the first invocation and cached in ~/.m2. The Kotlin step (ktfmt) is skipped entirely — including resolution — when the project has no .kt sources, so pure-Java builds pay no overhead.

Usage

$ curie fmt
# rewrites every .java file in place to the AOSP style.

Add --check to forbid edits — useful in CI. Curie runs both formatters and exits non-zero if any file would change, collecting errors from both so the full diff surfaces in one pass.

$ curie fmt --check
./src/com.example/Greeter.java
error: fmt: one or more Java files are not correctly formatted.
       Run `curie fmt` (without --check) to fix them.

Style

Both formatters use 4-space indentation to keep Java and Kotlin files visually consistent:

Style is not configurable per-project. The opinionated defaults remove the debate and match each language's widely-adopted community standard.

Source discovery

Java sources (.java) and Kotlin sources (.kt) are discovered from all source roots:

The ktfmt step is skipped entirely when no .kt files are present, so pure-Java projects pay zero overhead.

Workspace fan-out

Run curie fmt from a workspace root and Curie fans out across every member in parallel, one java process per member. palantir-java-format is resolved once at the start of the run and the JAR list is shared across the worker threads — concurrent identical resolves would otherwise race on the same ~/.m2 staging files.

$ curie fmt --check # CI in a monorepo
Workspace . fmt (12 members)
  Formatting      [==============>------] 9/12
    ⠹ jackson-bom-greeter
    ⠹ maven-string-utils
    ⠹ hello-mixed

Ignoring files

There is no per-file opt-out. If you need to keep generated or vendored sources untouched, keep them outside the source roots (e.g. under target/ for annotation-processor output, which is excluded automatically).