Format Java

Format Java source with Elide

elide javaformat formats Java source with Google Java Format.

Format files

elide javaformat -- Hello.java src/main/java

A normal invocation rewrites files in place. The standard replacement flags remain accepted for compatibility:

elide javaformat -- -i Hello.java

Check formatting

Use -n or --dry-run after --. The command exits 1 when a file would change:

elide javaformat -- -n src/main/java

Elide adds two reporting options before --:

elide javaformat --list-files -- -n src/main/java
elide javaformat --list-diffs -- -n src/main/java
elide javaformat --list-diffs=5 -- -n src/main/java

--list-diffs=N prints diffs only when at most N files fail; otherwise it falls back to listing paths. Use =N, not a separate value.

To format Java and Kotlin in one command, use:

elide format -- src