DEV Community

Committed Software
Committed Software

Posted on • Originally published at committed.software

Speedy Spotless

Speedy Spotless is a Maven plugin for easy formatting of staged changes. It is inspired by pretty-quick but for Java.

Spotless is a tool to automatically format your code. It can format in various languages in a multitude of different ways. Regularly running an automatic code formatter like Spotless is a great way to maintain a consistent code style and to keep changes readable. It is good practice to use a Git hook to format new code as it is being committed.

Existing approaches for formatting staged changes don't address what to do for the formatting of partially staged files. If the formatter makes changes to the file it is no longer obvious what changes to include in the commit! Speedy Spotless will format such files, but will cancel the commit, allowing the developer to decide what to do instead of doing something that the developer may not have intended.

Speedy Spotless is a drop in replacement for Spotless Maven Plugin and supports the same configuration options, but also includes the new goal speedy-spotless:staged to trigger the formatting staged changes and speedy-spotless:install-hooks that creates & installs the Git hook to format staged changes automatically. It will even preserve any existing hooks!

Speedy Spotless on Github.

Oldest comments (0)