Spotless can format <java | kotlin | scala | sql | groovy | javascript | flow | typeScript | css | scss | less | jsx | vue | graphql | json | yaml | 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 |
👍 | 👍 | ⬜ |
cpp.EclipseFormatterStep |
👍 | 👍 | ⬜ |
groovy.GrEclipseFormatterStep |
👍 | ⬜ | ⬜ |
java.GoogleJavaFormatStep |
👍 | 👍 | ⬜ |
java.ImportOrderStep |
👍 | 👍 | ⬜ |
java.RemoveUnusedImportsStep |
👍 | 👍 | ⬜ |
java.EclipseFormatterStep |
👍 | 👍 | ⬜ |
kotlin.KtLintStep |
👍 | 👍 | ⬜ |
markdown.FreshMarkStep |
👍 | ⬜ | ⬜ |
npm.PrettierFormatterStep |
👍 | ⬜ | ⬜ |
npm.TsFmtFormatterStep |
👍 | ⬜ | ⬜ |
scala.ScalaFmtStep |
👍 | 👍 | ⬜ |
sql.DBeaverSQLFormatterStep |
👍 | ⬜ | ⬜ |
wtp.EclipseWtpFormatterStep |
👍 | 👍 | ⬜ |
(Your FormatterStep here) | ⬜ | ⬜ | ⬜ |
Fast up-to-date checking | 👍 | ⬜ | ⬜ |
Automatic idempotency safeguard | 👍 | ⬜ | ⬜ |
- Thanks to Simon Gamma for adding support for npm-based formatters, including
prettier
andtsfmt
. - 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 Konstantin Lutovich for implementing the maven plugin.
- 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 Jonathan Bluett-Duncan for
- 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 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 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 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 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.