close
The Wayback Machine - https://web.archive.org/web/20190322175941/https://github.com/diffplug/spotless
Skip to content
Image
Please note that GitHub no longer supports Internet Explorer.

We recommend upgrading to the latest Microsoft Edge, Google Chrome, or Firefox.

Learn more
Keep your code spotless
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Image .ci
Image _ext Set changelog date. Mar 17, 2019
Image _images
Image gradle Publish lib & plugin-maven 1.20.0, plugin-gradle 3.20.0 Mar 14, 2019
Image ide Improved ide. Dec 22, 2016
Image javadoc-publish Fix javadoc-publish. Jan 9, 2017
Image lib-extra Upgrade WTP eclipse to version 3.9.8. Mar 11, 2019
Image lib
Image plugin-gradle fix typos in release dates (#377) Mar 16, 2019
Image plugin-maven Update README.md (#379) Mar 19, 2019
Image testlib
Image .editorconfig
Image .gitattributes Update gradle version to 4.4.1. (#186) Jan 8, 2018
Image .gitignore
Image .travis.yml
Image CHANGES.md
Image CODE_OF_CONDUCT.md Bump readme and docs http to https. Feb 15, 2019
Image CONTRIBUTING.md
Image ECLIPSE_SCREENSHOTS.md
Image ISSUE_TEMPLATE.md
Image LICENSE.txt
Image PADDEDCELL.md
Image PULL_REQUEST_TEMPLATE.md
Image README.md
Image build.gradle
Image gradle.properties Bump to 3.21.0-SNAPSHOT and 1.21.0-SNAPSHOT Mar 15, 2019
Image gradlew
Image gradlew.bat
Image settings.gradle
Image spotless.eclipseformat.xml XML Extension (#293) Sep 15, 2018
Image spotless.groovyformat.prefs Fixes according to review by @jbduncan (as far as possible, using the… Apr 8, 2017
Image spotless.importorder Moving spotless to a subfolder didn't work at all, it turns out. Whoops. Jan 6, 2017
Image spotless.license Moving spotless to a subfolder didn't work at all, it turns out. Whoops. Jan 6, 2017
Image spotless.xmlformat.prefs
Image spotlessSelf.gradle Wtp integration maven gradle (#325) Dec 30, 2018

README.md

Image Spotless: Keep your code spotless

Travis CI Live chat License Apache

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.

Current feature matrix

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 👍 ⬜️ ⬜️

Acknowledgements

You can’t perform that action at this time.