Skip to main content

Code Formatting

Bleep provides a unified fmt command that formats both Scala and Java source files in your project.

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.8.6
maxColumn = 120
runner.dialect = scala3

Java Formatting

Bleep uses google-java-format for Java code formatting.

Configuration is optional via .javafmt.conf in your build directory. If no config file exists, defaults are used.

Configuration Properties

PropertyTypeDefaultDescription
enabledbooleantrueWhether Java formatting is enabled
versionstring1.33.0Version of google-java-format to use
stylestringgoogleFormatting style: google (2-space indent) or aosp (4-space indent)
skipSortingImportsbooleanfalseDon't sort import statements
skipRemovingUnusedImportsbooleanfalseKeep unused import statements
fixImportsOnlybooleanfalseOnly fix imports, don't reformat code
skipReflowingLongStringsbooleanfalseDon't reformat long strings
skipJavadocFormattingbooleanfalseDon't reformat Javadoc comments
excludePathslist[]Glob patterns for files to exclude

Example .javafmt.conf:

version = 1.33.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)