Spotless is a code formatter plugin that integrates with build systems to automatically format and fix code across multiple languages.
The tool solves the problem of maintaining consistent code formatting across projects by wrapping formatters as simple string transformation functions and handling the integration complexities that formatters typically ignore. It manages concerns like line endings, character encodings, idempotency, and git ratcheting so that formatter implementations can remain straightforward. Spotless composes multiple formatters together and works across different build systems, allowing teams to apply formatting rules uniformly without reimplementing integration logic for each formatter or build tool combination.
Spotless suits teams that want centralized, automated code formatting without manual configuration of each formatter's quirks. It works with Gradle, Maven, and SBT, with dedicated plugins for Gradle and Maven that include IDE integrations for VS Code and IntelliJ. The tool supports a wide range of languages including Java, Kotlin, Scala, Python, JavaScript, TypeScript, CSS, SQL, YAML, and many others, making it applicable to polyglot codebases. Projects that need to enforce formatting standards across multiple languages or build systems will find the unified approach valuable compared to managing separate formatter configurations.
The project maintains active development with regular updates to support new formatters and languages. The codebase demonstrates careful attention to edge cases and compatibility, as evidenced by dedicated test coverage for encoding errors and idempotency concerns. The maintainers have documented complex integration challenges like the ratcheting feature and padding cell behavior, indicating a commitment to helping contributors understand the non-obvious aspects of code formatting infrastructure.