diffplug/spotless is a UI-focused project on GitHub with 5.7k stars, written primarily in Java. Keep your code spotless
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
Spotless can format <antlr | c | c# | c++ | css | flow | graphql | groovy | html | java | javascript | json | jsx | kotlin | less | license headers | markdown | objective-c | protobuf | python | scala | scss | shell | sql | typeScript | vue | yaml | anything> using <gradle | maven | sbt | anything>.
You probably want one of the links below:
❇️ Spotless for Gradle (with integrations for VS Code and IntelliJ with Spotless Daemon or Spotless Gradle)
user@machine repo % ./gradlew build
:spotlessJavaCheck FAILED
The following files had format violations:
src\main\java\com\diffplug\gradle\spotless\FormatExtension.java
-\t\t····if·(targets.length·==·0)·{
+\t\tif·(targets.length·==·0)·{
Run './gradlew spotlessApply' to fix these violations.
user@machine repo % ./gradlew spotlessApply
:spotlessApply
BUILD SUCCESSFUL
user@machine repo % ./gradlew build
BUILD SUCCESSFUL
❇️ Spotless for Maven
user@machine repo % mvn spotless:check
[ERROR] > The following files had format violations:
[ERROR] src\main\java\com\diffplug\gradle\spotless\FormatExtension.java
[ERROR] -\t\t····if·(targets.length·==·0)·{
[ERROR] +\t\tif·(targets.length·==·0)·{
[ERROR] Run 'mvn spotless:apply' to fix these violations.
user@machine repo % mvn spotless:apply
[INFO] BUILD SUCCESS
user@machine repo % mvn spotless:check
[INFO] BUILD SUCCESS
❇️ Spotless for SBT (external for now)
Other build systems
How it works (for potential contributors)
Ideally, a code formatter can do more than just find formatting errors - it should fix them as well. Such a formatter is just a Function<String, String>, which returns a formatted version of its potentially unformatted input.
It's easy to build such a function, but there are some gotchas and lots of integration work (newlines, character encodings, idempotency, git ratcheting, and build-system integration). Spotless tackles those for you so you can focus on just a simple Function<String, String> which can compose with any of the other formatters and build tools in Spotless' arsenal.
Current feature matrix
Feature / FormatterStep
gradle
maven
sbt
(Your build tool here)
Automatic idempotency safeguard
:+1:
:+1:
:+1:
:white_large_square:
Misconfigured encoding safeguard
:+1:
:+1:
:+1:
:white_large_square:
Toggle with spotless:off and spotless:on
:+1:
:+1:
:white_large_square:
:white_large_square:
Ratchet from origin/main or other git ref
:+1:
:+1:
:white_large_square:
:white_large_square:
Define line endings using git
:+1:
:+1:
:+1:
:white_large_square:
Fast incremental format and up-to-date check
:+1:
:+1:
:white_large_square:
:white_large_square:
Fast format on fresh checkout using buildcache
:+1:
:white_large_square:
:white_large_square:
:white_large_square:
generic.EndWithNewlineStep
:+1:
:+1:
:white_large_square:
:white_large_square:
generic.IndentStep
:+1:
:+1:
:white_large_square:
:white_large_square:
generic.Jsr223Step
:white_large_square:
:+1:
:white_large_square:
:white_large_square:
generic.LicenseHeaderStep
:+1:
:+1:
:+1:
:white_large_square:
generic.NativeCmdStep
:+1:
:+1:
:white_large_square:
:white_large_square:
generic.ReplaceRegexStep
:+1:
:+1:
:white_large_square:
:white_large_square:
generic.ReplaceStep
:+1:
:+1:
:white_large_square:
:white_large_square:
generic.TrimTrailingWhitespaceStep
:+1:
:+1:
:white_large_square:
:white_large_square:
antlr4.Antlr4FormatterStep
:+1:
:+1:
:white_large_square:
:white_large_square:
biome.BiomeStep
:+1:
:+1:
:white_large_square:
:white_large_square:
cpp.ClangFormatStep
:+1:
:white_large_square:
:white_large_square:
:white_large_square:
cpp.EclipseCdtFormatterStep
:+1:
:+1:
:+1:
:white_large_square:
go.GofmtFormatStep
:+1:
:white_large_square:
:white_large_square:
:white_large_square:
gherkin.GherkinUtilsStep
:+1:
:+1:
:white_large_square:
:white_large_square:
groovy.GrEclipseFormatterStep
:+1:
:+1:
:+1:
:white_large_square:
java.GoogleJavaFormatStep
:+1:
:+1:
:+1:
:white_large_square:
java.ImportOrderStep
:+1:
:+1:
:+1:
:white_large_square:
java.PalantirJavaFormatStep
:+1:
:+1:
:white_large_square:
:white_large_square:
java.PrinceOfSpaceStep
:+1:
:+1:
:white_large_square:
:white_large_square:
java.RemoveUnusedImportsStep
:+1:
:+1:
:+1:
:white_large_square:
java.ExpandWildcardImportsStep
:+1:
:white_large_square:
:white_large_square:
:white_large_square:
java.ForbidWildcardImportsStep
:+1:
:+1:
:+1:
:white_large_square:
java.ForbidModuleImportsStep
:+1:
:+1:
:white_large_square:
:white_large_square:
java.ShortenFullyQualifiedTypesStep
:+1:
:+1:
:white_large_square:
:white_large_square:
java.EclipseJdtFormatterStep
:+1:
:+1:
:+1:
:white_large_square:
java.FormatAnnotationsStep
:+1:
:+1:
:white_large_square:
:white_large_square:
java.CleanthatJavaStep
:+1:
:+1:
:white_large_square:
:white_large_square:
java.TableTestFormatterStep
:+1:
:+1:
:white_large_square:
:white_large_square:
json.gson.GsonStep
:+1:
:+1:
:white_large_square:
:white_large_square:
json.JacksonJsonStep
:+1:
:+1:
:white_large_square:
:white_large_square:
json.JsonSimpleStep
:+1:
:+1:
:white_large_square:
:white_large_square:
json.JsonPatchStep
:+1:
:+1:
:white_large_square:
:white_large_square:
kotlin.KtLintStep
:+1:
:+1:
:+1:
:white_large_square:
kotlin.KtfmtStep
:+1:
:+1:
:white_large_square:
:white_large_square:
kotlin.DiktatStep
:+1:
:+1:
:white_large_square:
:white_large_square:
markdown.FreshMarkStep
:+1:
:white_large_square:
:white_large_square:
:white_large_square:
markdown.FlexmarkStep
:+1:
:+1:
:white_large_square:
:white_large_square:
npm.EslintFormatterStep
:+1:
:+1:
:white_large_square:
:white_large_square:
npm.PrettierFormatterStep
:+1:
:+1:
:white_large_square:
:white_large_square:
npm.TsFmtFormatterStep
:+1:
:+1:
:white_large_square:
:white_large_square:
pom.SortPomStep
:+1:
:+1:
:white_large_square:
:white_large_square:
protobuf.BufStep
:+1:
:white_large_square:
:white_large_square:
:white_large_square:
python.BlackStep
:+1:
:white_large_square:
:white_large_square:
:white_large_square:
rdf.RdfFormatterStep
:white_large_square:
:+1:
:white_large_square:
:white_large_square:
scala.ScalaFmtStep
:+1:
:+1:
:+1:
:white_large_square:
shell.ShfmtStep
:+1:
:+1:
:white_large_square:
:white_large_square:
sql.DBeaverSQLFormatterStep
:+1:
:+1:
:+1:
:white_large_square:
wtp.EclipseWtpFormatterStep
:+1:
:+1:
:white_large_square:
:white_large_square:
yaml.JacksonYamlStep
:+1:
:+1:
:white_large_square:
:white_large_square:
(Your FormatterStep here)
:white_large_square:
:white_large_square:
:white_large_square:
:white_large_square:
Why are there empty squares?
Many projects get harder to work on as they get bigger. Spotless is easier to work on than ever, and one of the reasons why is that we don't require contributors to "fill the matrix". If you want to add Bazel support, we'd happily accept the PR even if it only supports the one formatter you use. And if you want to add FooFormatter support, we'll happily accept the PR even if it only supports the one build system you use.
Once someone has filled in one square of the formatter/build system matrix, it's easy for interested parties to fill in any empty squares, since you'll now have a working example for every piece needed.
Acknowledgements
Thanks to over 200 contributors with merged PRs, and also to everyone who helped with code review, file reproducible bugs, etc. A few contributions stand out as especially significant to the history of the project, though regrettably there are certain to be some important omissions!
Thanks to Zongle Wang for an enormous mound of contributions, but especially for his near-rewrite so that Spotless could support Gradle's configuration cache natively.
Thanks to Simon Gamma for adding support for npm-based formatters, twice including prettier and tsfmt.
Thanks to Konstantin Lutovich for implementing and maintaining the Maven plugin, as well as fixing remote-build cache support for Gradle.
Thanks to Frank Vennemeyer for Groovy support via greclipse, C++ support via CDT, XML support via WTP and a huge body of work with other eclipse-based formatters.
Thanks to Jonathan Bluett-Duncan for
implementing up-to-date checking #31
breaking spotless into libraries #56
lots of other things, but especially the diff support in spotlessCheck
constant improvements on a variety of topics with high-quality code reviews
Thanks to Daz DeBoer for the reworking the guts of our Gradle plugin to support buildcache, InputChanges, and lazy configuration.
Thanks to Richard Willis for creating the VS Code extension for Spotless Gradle.
Thanks to Ryan Gurney for creating the IntelliJ plugin for Spotless Gradle.
Thanks to Alex Danylenko for creating the git pre-push hook.
Thanks to Markus Heberling for adding generic native formatters, jsr-223 formatters, and maven pom sorting.
Thanks to Matthias Balke for adding support for Antlr.
Thanks to Matthias Andreas Benkard for adding support for google-java-format 1.8+ (#563)
Thanks to Thomas Broyer for adding support for google-java-format's skip-reflowing-long-strings option.
Thanks to Hakanai for adding wildcards last support to the import sorter.
Thanks to Kevin Brooks for updating all eclipse-based formatters to 4.13 and fixing Groovy for multiproject.
Thanks to Dylan Baroody for fixing sql formatting support for JDBI bind list params.
Thanks to figroc for adding custom mavenCoordinate support to google-java-format.
Thanks to Thomas Glaeser for finding and fixing a file-permissions-clobbering bug.
Thanks to Joan Goyeau for fixing scalafmt integration.
Thanks to Nick Sutcliffe for fixing scalafmt post-2.0.
Thanks to Baptiste Mesta for
porting the DBeaver formatter to Spotless, and thanks to DBeaver and its authors for their excellent SQL formatter.
making license headers date-aware #179
Thanks to vmdominguez and Luis Fors for adding the ability to limit formatting to specific files in Gradle (#322) and Maven (#392), respectively.
Thanks to bender316 for fixing classloading on Java 9 (#426).
Thanks to Stefan Oehme for tons of help on the internal mechanics of Gradle.
Thanks to eyalkaspi for adding configurable date ranges to the date-aware license headers.
Thanks to Andrew Parmet for adding ktfmt support for kotlin gradle.
Thanks to Oliver Horn for adding AOSP support for Spotless' google-java-format integration.
Formatting by Eclipse
Special thanks to Mateusz Matela for huge improvements to the eclipse code formatter!
Thanks to Zac Sweers for fixing the highly requested ktlint 0.34+ support (#469), multiple build updates and fixing a Gradle deprecation warning (#434 and others).
Thanks to Stephen Panaro for adding support for ktlint FilenameRule (#974).
Thanks to Nelson Osacky for android doc improvements, versions bump, and a build improvement.
Thanks to Stanley Shyiko for his help integrating ktlint.
Thanks to Jonathan Leitschuh for adding ktlint support for Gradle Kotlin DSL files.
Originally forked from gradle-format-plugin by Youri Bonnaffé.
Thanks to Ismaël Mejía for bumping eclipse-jdt deps to 4.11. PR #60.
Thanks to Gábor Bernát for improvements to logging and multi-project support.
Thanks to Oliver Szymanski for porting tsfmt and prettier to maven.
Thanks to Andrew Oberstar for improvements to formatting java source in non-java source sets. PR #60.
Thanks to Sameer Balasubrahmanyam for adding support for IntelliJ-style year placeholders.
Thanks to Jamie Tanna for adding a simple JSON formatter.
Thanks to Adib Saikali and Paul Merlin for tracking down the tricky cause of #506.
The most recent commit recorded on diffplug/spotless was 6 days ago, based on the GitHub push timestamp. The repository has 569 forks — one of the better signals of community interest.
How many stars does diffplug/spotless have?
diffplug/spotless has 5.7k GitHub stars — refresh the page for the live number, or check github.com/diffplug/spotless. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
What else is in the Frontend space?
diffplug/spotless is tracked by TopGit under the Frontend category, alongside 14 GitHub-tagged topics. Trending and Topics pages list peer repositories of comparable stars and language.
What language is diffplug/spotless written in?
diffplug/spotless is written primarily in Java. GitHub's language field is based on the largest share of bytes in the default branch.
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/diffplug/spotless is the definitive source.
Why is diffplug/spotless categorized under Frontend?
TopGit places diffplug/spotless in the Frontend category based on its GitHub topics and description (tagged: "css", "formatter", "gradle"). Categories are assigned from real repository metadata, not editorial guesswork.
Read full README in the tab above.
Curious whether spotless is right for you?
Let ChatGPT, Claude, or Perplexity look into it — click below and see what AI actually says about spotless.