Spotless can format <java | markdown | license headers | anything> using <gradle | maven | anything>.
Ideally, a code formatter can do more than just find formatting errors - it should fix them as well. Such a formatter is really 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, 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.
Feature / FormatterStep | plugin-gradle | plugin-maven | (Your build tool here) |
---|---|---|---|
generic.EndWithNewlineStep |
π | β¬ | β¬ |
generic.IndentStep |
π | β¬ | β¬ |
generic.LicenseHeaderStep |
π | β¬ | β¬ |
generic.ReplaceRegexStep |
π | β¬ | β¬ |
generic.ReplaceStep |
π | β¬ | β¬ |
generic.TrimTrailingWhitespaceStep |
π | β¬ | β¬ |
groovy.GrEclipseFormatterStep |
π | β¬ | β¬ |
java.GoogleJavaFormatStep |
π | β¬ | β¬ |
java.ImportOrderStep |
π | β¬ | β¬ |
java.EclipseFormatterStep |
π | β¬ | β¬ |
kotlin.KtLintStep |
π | β¬ | β¬ |
markdown.FreshMarkStep |
π | β¬ | β¬ |
scala.ScalaFmtStep |
π | β¬ | β¬ |
(Your FormatterStep here) | β¬ | β¬ | β¬ |
Fast up-to-date checking | π | β¬ | β¬ |
Automatic idempotency safeguard | π | β¬ | β¬ |
- Huge thanks to Jonathan Bluett-Duncan for
- Huge thanks to Frank Vennemeyer for Groovy support via greclipse.
- Huge thanks to Stefan Oehme for tons of help on the internal mechanics of Gradle.
- Formatting by Eclipse
- Special thanks to Mateusz Matela for huge improvements to the eclipse code formatter!
- 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 GΓ‘bor BernΓ‘t for improvements to logging and multi-project support.
- Thanks to Andrew Oberstar for improvements to formatting java source in non-java source sets. PR #60.
- Import ordering from EclipseCodeFormatter.
- Built by gradle.
- Tested by junit.
- Maintained by DiffPlug.