kempt is a little hobby project I've put together to get away from Spotless/Gradle and simplify setting up commit hooks across my projects.
kempt is a single-entry point CLI that delegates to language-specific formatters with easy installation, automatic binary management, git hook integration, license headers, whitespace handling, and simple configuration.Spotless (and other formatter Gradle plugins) are frankly too heavy-weight because they run on Gradle. Most repos I work in that need to move away from Gradle-based formatting then eventually collect a familiar little pile of formatting scripts. kempt aims to turn that pile into one repo-local pipeline.
Right now it supports:
- Kotlin via
ktfmt - Java via
google-java-format - Rust via
cargo fmt - License header insertion
- Trailing whitespace normalization. Repos configure it with a
.kempt.toml, then use the same tool locally, in pre-commit, and in CI.
Quickstart
$ brew install ZacSweers/tap/kempt-fmt
$ kempt init # inits a .kempt.toml based on detected langs
$ kempt install-hook # optional git commit hook integration
$ kempt format|check # runs the format or checkFor CI, kempt check is the read-only mode. It exits non-zero when files need formatting and prints the command to fix them. For local commits, the hook formats staged files and re-stages only the files it changed, while refusing* unsafe partial-staging cases instead of silently pulling unrelated work into a commit.
Full usage/configuration/details are all in the repo README.md!
*it does support formatters that support partial formats! Namely GJF and (a future version of) ktfmt.