Code Formatting
Bleep provides a unified fmt command that formats Scala, Java, and Kotlin source files in your project.
The formatter for a given language is only downloaded if your project actually contains files of that language, so polyglot or single-language builds pay only for what they use.
Basic Usage
# Format all source files
bleep fmt
# Check formatting without making changes (useful for CI)
bleep fmt --check
Scala Formatting
Bleep uses scalafmt for Scala code formatting.
Configuration is done via .scalafmt.conf in your build directory. If no config exists, bleep creates a default one.
For full configuration options, see the scalafmt documentation.
Example .scalafmt.conf:
version = 3.11.1
maxColumn = 120
runner.dialect = scala3
Java Formatting
Bleep uses google-java-format for Java code formatting.
google-java-format itself has no native config file — it is driven entirely by CLI flags. Bleep exposes those flags through an optional .javafmt.conf (HOCON) in the build directory. With no file present, sensible defaults are used.
Configuration Properties
| Property | Type | Default | Description |
|---|---|---|---|
enabled | boolean | true | Whether Java formatting is enabled |
version | string | 1.35.0 | Version of google-java-format to use |
style | string | google | Formatting style: google (2-space indent) or aosp (4-space indent) |
skipSortingImports | boolean | false | Don't sort import statements |
skipRemovingUnusedImports | boolean | false | Keep unused import statements |
fixImportsOnly | boolean | false | Only fix imports, don't reformat code |
skipReflowingLongStrings | boolean | false | Don't reformat long strings |
skipJavadocFormatting | boolean | false | Don't reformat Javadoc comments |
excludePaths | list | [] | Glob patterns for files to exclude |
Example .javafmt.conf:
version = 1.35.0
style = aosp
# Skip Javadoc formatting
skipJavadocFormatting = true
# Exclude generated files
excludePaths = ["glob:**/generated/**", "glob:**/build/**"]
Notes
- Line length is fixed at 100 characters (google-java-format design decision)
- Indentation is fixed per style (2-space for Google, 4-space for AOSP)
Kotlin Formatting
Bleep uses ktfmt for Kotlin code formatting.
Like google-java-format, ktfmt has no native config file. Bleep exposes its (small) flag surface through an optional .kotlinfmt.conf (HOCON) in the build directory. With no file present, sensible defaults are used.
Configuration Properties
| Property | Type | Default | Description |
|---|---|---|---|
enabled | boolean | true | Whether Kotlin formatting is enabled |
version | string | 0.62 | Version of ktfmt to use |
style | string | kotlinlang | Formatting style: kotlinlang (official Kotlin coding conventions), google (Android/Google), or meta (Facebook/ktfmt default) |
excludePaths | list | [] | Glob patterns for files to exclude |
Example .kotlinfmt.conf:
version = 0.62
style = kotlinlang
# Exclude generated files
excludePaths = ["glob:**/generated/**"]
Notes
- ktfmt is deliberately near-zero-configuration. Only the listed style switches are exposed; line length and indent are fixed per style.