If you are a Spotless user (as opposed to developer), then you are probably looking for:
This document is intended for Spotless developers.
We adhere to the keepachangelog format (starting after version 1.27.0
).
- Bump default
ktlint
version to latest1.3.0
->1.4.0
. (#2314) - Add Sort Members feature based on Eclipse JDT implementation. (#2312)
- Bump default
jackson
version to latest2.18.0
->2.18.1
. (#2319) - Bump default
ktfmt
version to latest0.52
->0.53
. (#2320)
- You can now use
removeUnusedImports
andgoogleJavaFormat
at the same time again. (fixes #2159) - The default list of type annotations used by
formatAnnotations
now includes Jakarta Validation'sValid
and constraints validations (fixes #2334)
- APIs to support linting. (implemented in #2148, #2149, #2307)
- Spotless is still primarily a formatter, not a linter. But when formatting fails, it's more flexible to model those failures as lints so that the formatting can continue and ideally we can also capture the line numbers causing the failure.
Lint
models a single change. AFormatterStep
can create a lint by:- throwing an exception during formatting, ideally
throw Lint.atLine(127, "code", "Well what happened was...")
- or by implementing the
List<Lint> lint(String content, File file)
method to create multiple of them
- throwing an exception during formatting, ideally
- Support for line ending policy
PRESERVE
which just takes the first line ending of every given file as setting (no matter if\n
,\r\n
or\r
) (#2304)
- BREAKING Moved
PaddedCell.DirtyState
to its own top-level class with new methods. (#2148)- BREAKING Removed
isClean
,applyTo
, andapplyToAndReturnResultIfDirty
fromFormatter
because users should instead useDirtyState
.
- BREAKING Removed
ktlint
steps now read from thestring
instead of thefile
so they don't clobber earlier steps. (fixes #1599)
- Support for
rdf
(#2261) - Support for
buf
on maven plugin (#2291) ConfigurationCacheHack
so we can support Gradle's configuration cache and remote build cache at the same time. (#2298 fixes #2168)
- Support configuring the Equo P2 cache. (#2238)
- Add explicit support for JSONC / CSS via biome, via the file extensions
.css
and.jsonc
. (#2259) - Bump default
buf
version to latest1.24.0
->1.44.0
. (#2291) - Bump default
google-java-format
version to latest1.23.0
->1.24.0
. (#2294) - Bump default
jackson
version to latest2.17.2
->2.18.0
. (#2279) - Bump default
cleanthat
version to latest2.21
->2.22
. (#2296)
- Java import order, ignore duplicate group entries. (#2293)
- Support toning down sortPom logging. (#2185)
- Bump default
ktlint
version to latest1.2.1
->1.3.0
. (#2165) - Bump default
ktfmt
version to latest0.49
->0.52
. (#2172, #2231) - Rename property
ktfmt
optionremoveUnusedImport
->removeUnusedImports
to matchktfmt
. (#2172) - Bump default
eclipse
version to latest4.29
->4.32
. (#2179) - Bump default
greclipse
version to latest4.29
->4.32
. (#2179, #2190) - Bump default
cdt
version to latest11.3
->11.6
. (#2179) - Bump default
gson
version to latest2.10.1
->2.11.0
. (#2128) - Bump default
jackson
version to latest2.17.1
->2.17.2
. (#2195) - Bump default
cleanthat
version to latest2.20
->2.21
. (#2210) - Bump default
google-java-format
version to latest1.22.0
->1.23.0
. (#2212)
- Fix compatibility issue introduced by
ktfmt
0.51
. (#2172)
- Add option
manageTrailingCommas
toktfmt
. (#2177)
FileSignature.Promised
andJarState.Promised
to facilitate round-trip serialization for the Gradle configuration cache. (#1945)- Respect
.editorconfig
settings for formatting shell viashfmt
(#2031)
- Check if ktlint_code_style is set in .editorconfig before overriding it (#2143)
- Ignore system git config when running tests (#1990)
- Correctly provide EditorConfig property types for Ktlint (#2052)
- Made ShadowCopy (
npmInstallCache
) more robust by re-creating the cache dir if it goes missing (#1984,2096) - scalafmt.conf fileOverride section now works correctly (#1854)
- Fix stdin pipe is being closed exception on Windows for large .proto files (#2147)
- Reworked ShadowCopy (
npmInstallCache
) to use atomic filesystem operations, resolving several race conditions that could arise (#2151)
- Bump default
cleanthat
version to latest2.16
->2.20
. (#1725) - Bump default
gherkin-utils
version to latest8.0.2
->9.0.0
. (#1703) - Bump default
google-java-format
version to latest1.19.2
->1.22.0
. (#2129) - Bump default
jackson
version to latest2.14.2
->2.17.1
. (#1685) - Bump default
ktfmt
version to latest0.46
->0.49
. (#2045, #2127) - Bump default
ktlint
version to latest1.1.1
->1.2.1
. (#2057) - Bump default
scalafmt
version to latest3.7.3
->3.8.1
. (#1730) - Bump default
shfmt
version to latest3.7.0
->3.8.0
. (#2050) - Bump default
sortpom
version to latest3.2.1
->4.0.0
. (#2049, #2078, #2115) - Bump default
zjsonpatch
version to latest0.4.14
->0.4.16
. (#1969)
- BREAKING Remove
FormatterStep.createNeverUpToDate
methods, they are available only intestlib
. (#2145) - BREAKING Remove
JarState.getMavenCoordinate(String prefix)
. (#1945) - BREAKING Replace
PipeStepPair
withFenceStep
. (#1954) - BREAKING Fully removed
Rome
, useBiome
instead. (#2119) - BREAKING Moved
PaddedCell.DirtyState
to its own top-level class with new methods. (#2148)- BREAKING Removed
isClean
,applyTo
, andapplyToAndReturnResultIfDirty
fromFormatter
because users should instead useDirtyState
.
- BREAKING Removed
- New static method to
DiffMessageFormatter
which allows to retrieve diffs with their line numbers (#1960) - Gradle - Support for formatting shell scripts via shfmt. (#1994)
- Fix empty files with biome >= 1.5.0 when formatting files that are in the ignore list of the biome configuration file. (#1989 fixes #1987)
- Fix a regression in BufStep where the same arguments were being provided to every
buf
invocation. (#1976)
- Use palantir-java-format 2.39.0 on Java 21. (#1948)
- Bump default
ktlint
version to latest1.0.1
->1.1.1
. (#1973) - Bump default
googleJavaFormat
version to latest1.18.1
->1.19.2
. (#1971) - Bump default
diktat
version to latest1.2.5
->2.0.0
. (#1972)
- Eclipse-based steps which contained any jars with a
+
in their path were broken, now fixed. (#1860)
- Bump default
palantir-java-format
version to latest2.28.0
->2.38.0
on Java 21. (#1920) - Bump default
googleJavaFormat
version to latest1.17.0
->1.18.1
. (#1920) - Bump default
ktfmt
version to latest0.44
->0.46
. (#1927) - Bump default
eclipse
version to latest4.27
->4.29
. (#1939) - Bump default
greclipse
version to latest4.28
->4.29
. (#1939) - Bump default
cdt
version to latest11.1
->11.3
. (#1939)
- Support custom rule sets for Ktlint. (#1896)
- Bump default
ktlint
version to latest1.0.0
->1.0.1
. (#1855) - Add a Step to remove semicolons from Groovy files. (#1881)
- Support for biome. The Rome project was renamed to Biome.
The configuration is still the same, but you should switch to the new
biome
tag / function and adjust the version accordingly. (#1804). - Support for
google-java-format
'sskip-javadoc-formatting
option. (#1793) - Support configuration of mirrors for P2 repositories in Maven DSL (#1697).
- New line endings mode
GIT_ATTRIBUTES_FAST_ALLSAME
. (#1838)
- Fix support for plugins when using Prettier version
3.0.0
and newer. (#1802) - Fix configuration cache issue around
external process started '/usr/bin/git --version'
. (#1806)
- Bump default
flexmark
version to latest0.64.0
->0.64.8
. (#1801) - Bump default
ktlint
version to latest0.50.0
->1.0.0
. (#1808)
- Add a
jsonPatch
step tojson
formatter configurations. This allows patching of JSON documents using JSON Patches. (#1753) - Support GJF own import order. (#1780)
- Use latest versions of popular style guides for
eslint
tests to fix failinguseEslintXoStandardRules
test. (#1761, #1756) - Add support for
prettier
version3.0.0
and newer. (#1760, #1751) - Fix npm install calls when npm cache is not up-to-date. (#1760, #1750)
- Bump default
eslint
version to latest8.31.0
->8.45.0
(#1761) - Bump default
prettier
version to latest (v2)2.8.1
->2.8.8
. (#1760) - Bump default
greclipse
version to latest4.27
->4.28
. (#1775)
- Added support for Protobuf formatting based on Buf. (#1208)
enum OnMatch { INCLUDE, EXCLUDE }
so thatFormatterStep.filterByContent
can not only include based on the pattern but also exclude. (#1749)
- Update documented default
semanticSort
tofalse
. (#1728)
- Bump default
cleanthat
version to latest2.13
->2.17
. (#1734) - Bump default
ktlint
version to latest0.49.1
->0.50.0
. (#1741)- Dropped support for
ktlint 0.47.x
following our policy of supporting two breaking changes at a time. - Dropped support for deprecated
useExperimental
parameter in favor of thektlint_experimental
property.
- Dropped support for
Jvm.Support
now accepts-SNAPSHOT
versions, treated as the non-SNAPSHOT
. (#1583)- Support Rome as a formatter for JavaScript and TypeScript code. Adds a new
rome
step tojavascript
andtypescript
formatter configurations. (#1663) - Add semantics-aware Java import ordering (i.e. sort by package, then class, then member). (#522)
- Fixed a regression which changed the import sorting order in
googleJavaFormat
introduced in2.38.0
. (#1680) - Equo-based formatters now work on platforms unsupported by Eclipse such as PowerPC (fixes durian-swt#20)
- When P2 download fails, indicate the responsible formatter. (#1698)
- Equo-based formatters now download metadata to
~/.m2/repository/dev/equo/p2-data
rather than~/.equo
, and for CI machines without a home directory the p2 data goes to$GRADLE_USER_HOME/caches/p2-data
. (#1714) - Bump default
googleJavaFormat
version to latest1.16.0
->1.17.0
. (#1710) - Bump default
ktfmt
version to latest0.43
->0.44
. (#1691) - Bump default
ktlint
version to latest0.48.2
->0.49.1
. (#1696)- Dropped support for
ktlint 0.46.x
following our policy of supporting two breaking changes at a time.
- Dropped support for
- Bump default
sortpom
version to latest3.0.0
->3.2.1
. (#1675)
- Support configuration of mirrors for P2 repositories in
EquoBasedStepBuilder
(#1629). - The
style
option in Palantir Java Format (#1654). - Added formatter for Gherkin feature files (#1649).
- POTENTIALLY BREAKING Converted
googleJavaFormat
to a compile-only dependency and drop support for versions <1.8
. (#1630) - Bump default
cleanthat
version to latest2.6
->2.13
. (#1589 and #1661) - Bump default
diktat
version1.2.4.2
->1.2.5
. (#1631) - Bump default
flexmark
version0.62.2
->0.64.0
. (#1302) - Bump default
googleJavaFormat
version1.15.0
->1.16.0
. (#1630) - Bump default
scalafmt
version3.7.1
->3.7.3
. (#1584) - Bump default Eclipse formatters for the 2023-03 release. (#1662)
- JDT and GrEclipse
4.26
->4.27
- Improve GrEclipse error reporting. (#1660)
- CDT
11.0
->11.1
- JDT and GrEclipse
- We are now opting in to Gradle's new stable configuration cache. (#1591)
- Adopt Equo Solstice OSGi and p2 shim to update all Eclipse-based plugins. (#1524)
- Eclipse JDT now supports
4.9
through4.26
. Also we now recommend dropping the last.0
, e.g.4.26
instead of4.26.0
, you'll get warnings to help you switch. - Eclipse Groovy now supports
4.18
through4.26
. Also we now recommend dropping the last.0
, e.g.4.26
instead of4.26.0
, you'll get warnings to help you switch. - Eclipse CDT now supports
10.6
through11.0
. - Eclipse WTP is still WIP at #1622.
- Eclipse JDT now supports
gradlew equoIde
opens a repeatable clean Spotless dev environment. (#1523)cleanthat
addedincludeDraft
option, to include draft mutators from composite mutators. (#1574)npm
-based formatters now support caching ofnode_modules
directory (#1590)
JacksonJsonFormatterFunc
handles json files with an Array as root. (#1585)
- Bump default
cleanthat
version to latest2.1
->2.6
(#1569 and #1574) - Reduce logging-noise created by
npm
-based formatters (#1590 fixes #1582)
- CleanThat Java Refactorer. (#1560)
- Introduce
LazyArgLogger
to allow for lazy evaluation of log messages in slf4j logging. (#1565)
- Allow multiple instances of the same npm-based formatter to be used by separating their
node_modules
directories. (#1565) ktfmt
default style uses correct continuation indent. (#1562)
- Bump default
ktfmt
version to latest0.42
->0.43
(#1561) - Bump default
jackson
version to latest2.14.1
->2.14.2
(#1536)
- POTENTIALLY BREAKING
sortByKeys
for JSON formatting now takes into account objects inside arrays (#1546) freshmark
fixed on java 15+ (#1304 fixes #803)
Formatter
now has a fieldpublic static final File NO_FILE_SENTINEL
which can be used to pass string content to a Formatter or FormatterStep when there is no actual File to format. (#1525)
ProcessRunner
has added some convenience methods so it can be used for Maven testing. (#1496)ProcessRunner
allows to limit captured output to a certain number of bytes. (#1511)ProcessRunner
is now capable of handling long-running tasks where waiting for exit is delegated to the caller. (#1511)- Allow to specify node executable for node-based formatters using
nodeExecutable
parameter (#1500)
- The default list of type annotations used by
formatAnnotations
has had 8 more annotations from the Checker Framework added #1494
- POTENTIALLY BREAKING Bump minimum JRE from 8 to 11, next release likely to bump bytecode to Java 11 (#1514 part 1 of #1337)
- Rename
YamlJacksonStep
intoJacksonYamlStep
while normalizing Jackson usage (#1492) - Convert
gson
integration to use a compile-only source set (#1510). - ** POTENTIALLY BREAKING** Removed support for KtLint 0.3x and 0.45.2 (#1475)
KtLint
does not maintain a stable API - before this PR, we supported every breaking change in the API since 2019.- From now on, we will support no more than 2 breaking changes at a time.
- NpmFormatterStepStateBase delays
npm install
call until the formatter is first used. This enables better integration withgradle-node-plugin
. (#1522) - Bump default
ktlint
version to latest0.48.1
->0.48.2
(#1529) - Bump default
scalafmt
version to latest3.6.1
->3.7.1
(#1529)
- Add option
editorConfigFile
forktLint
#142- POTENTIALLY BREAKING
ktlint
step now modifies license headers. Make sure to putlicenseHeader
afterktlint
.
- POTENTIALLY BREAKING
- Added
skipLinesMatching
option tolicenseHeader
to support formats where license header cannot be immediately added to the top of the file (e.g. xml, sh). (#1441). - Add YAML support through Jackson (#1478)
- Added support for npm-based ESLint-formatter for javascript and typescript (#1453)
- Better suggested messages when user's default is set by JVM limitation. (#995)
- Support
ktlint
0.48+ new rule disabling syntax (#1456) fixes (#1444) - Fix subgroups leading catch all matcher.
- Bump default version for
prettier
from2.0.5
to2.8.1
(#1453) - Bump the dev version of Gradle from
7.5.1
to7.6
(#1409)- We also removed the no-longer-required dependency
org.codehaus.groovy:groovy-xml
- We also removed the no-longer-required dependency
- Breaking changes to Spotless' internal testing infrastructure
testlib
(#1443)ResourceHarness
no longer has any duplicated functionality which was also present inStepHarness
StepHarness
now operates onFormatter
rather than aFormatterStep
StepHarnessWithFile
now takes aResourceHarness
in its constructor to handle the file manipulation parts- Standardized that we test exception messages, not types, which will ease the transition to linting later on
- Bump default
ktlint
version to latest0.47.1
->0.48.1
(#1456)
- Switch our publishing infrastructure from CircleCI to GitHub Actions (#1462).
- Help wanted for moving our tests too (#1472)
- Bump default
ktlint
version to latest0.47.1
->0.48.0
(#1432) - Bump default
ktfmt
version to latest0.41
->0.42
(#1421)
importOrder
now support groups of imports without blank lines (#1401)
- Don't treat
@Value
as a type annotation #1367 - Support
ktlint_disabled_rules
inktlint
0.47.x #1378 - Share git repositories across projects when using ratchet (#1426)
- Bump default
ktfmt
version to latest0.40
->0.41
(#1340) - Bump default
scalafmt
version to latest3.5.9
->3.6.1
(#1373) - Bump default
diktat
version to latest1.2.3
->1.2.4.2
(#1393) - Bump default
palantir-java-format
version to latest2.10
->2.28
(#1393)
formatAnnotations()
step to correct formatting of Java type annotations. It puts type annotations on the same line as the type that they qualify. Run it after a Java formatting step, such asgoogleJavaFormat()
. (#1275)
- Bump default
ktfmt
version to latest0.39
->0.40
(#1312) - Bump default
ktlint
version to latest0.46.1
->0.47.1
(#1303)- Also restored support for older versions of ktlint back to
0.31.0
- Also restored support for older versions of ktlint back to
scalafmt
integration now has a configuration optionmajorScalaVersion
that allows you to configure the Scala version that gets resolved from the Maven artifact (#1283)- Converted
scalafmt
integration to use a compile-only source set (fixes #524)
- Converted
- Add the
ktlint
rule in error messages whenktlint
fails to apply a fix (#1279) - Bump default
scalafmt
to latest3.0.8
->3.5.9
(removed support for pre-3.0.0
) (#1283)
- Bump default
diktat
version to latest1.2.1
->1.2.3
(#1266)
- Clang and Black no longer break the build when the binary is unavailable, if they will not be run during that build (#1257).
- License header support for Kotlin files without
package
or@file
but do at least haveimport
(#1263).
- Bump default
ktlint
version to latest0.45.2
->0.46.1
(#1239)- Minimum supported version also bumped to
0.46.0
(we have abandoned strong backward compatibility forktlint
, from here on out Spotless will only support the most-recent breaking change).
- Minimum supported version also bumped to
- Bump default
diktat
version to latest1.1.0
->1.2.1
(#1246)- Minimum supported version also bumped to
1.2.1
(diktat is based on ktlint and has the same backward compatibility issues).
- Minimum supported version also bumped to
- Bump default
ktfmt
version to latest0.37
->0.39
(#1240)
PalantirJavaFormatStep
no longer needs the--add-exports
calls in theorg.gradle.jvmargs
property ingradle.properties
. (#1233)
- (Second try)
googleJavaFormat
andremoveUnusedImports
works on JDK16+ without jvm args workaround. (#1228)
google-java-format
andRemoveUnusedImportsStep
works on JDK16+ without jvm args workaround. (#1224 fixes #834)
- Update the
black
version regex to fix19.10b0
and earlier. (fixes #1195, regression introduced in2.25.0
) GitAttributesLineEndings$RelocatablePolicy
andFormatterStepImpl
now null-out their initialization lambdas after their state has been calculated, which allows GC to collect variables which were incidentally captured but not needed in the calculated state. (#1198)
- Bump default
ktfmt
version to latest0.36
->0.37
. (#1200)
- Bump default
diktat
version to latest1.0.1
->1.1.0
. (#1190)
- Bump default
ktfmt
version to latest0.35
->0.36
. (#1183) - Bump default
google-java-format
version to latest1.13.0
->1.15.0
.This means it is no longer necessary to use the--add-exports
workaround (fixes #834).--add-exports
workaround is still needed.
- Added support for enabling ktlint experimental ruleset. (#1145)
- Fixed support for Python Black's new version reporting. (#1170)
- Error messages for unexpected file encoding now works on Java 8. (fixes #1081)
- Bump default
black
version to latest19.10b0
->22.3.0
. (#1170) - Bump default
ktfmt
version to latest0.34
->0.35
. (#1159) - Bump default
ktlint
version to latest0.43.2
->0.45.2
. (#1177)
- Git user config and system config also included for defaultEndings configuration. (#540)
- Fixed access modifiers for setters in KtfmtStep configuration
- Added support for setting custom parameters for Kotlin ktfmt in Gradle and Maven plugins. (#1145)
- Use SLF4J for logging (#1116)
- Bump default ktfmt
0.30
->0.31
(#1118).
- Add full support for git worktrees (#1119).
- Bump CI from Java 15 to 17 (#1094).
- Bump default versions of formatters (#1095).
- google-java-format
1.12.0
->1.13.0
- ktfmt
0.29
->0.30
- google-java-format
- Added support for git property
core.autocrlf
(#540)
- Added support for the palantir-java-format Java formatter (#1083).
- Update IndentStep to allow leading space on multiline comments (#1072).
- Bumped default DiKTat from
0.4.0
to1.0.1
. This is a breaking change for DiKTat users on the default version, because some rules were renamed/changed. Check DiKTat changelog for details.
- Added support for Markdown with
flexmark
at0.62.2
(#1011).
- Performance improvements to GitRatchet (#1038).
- Bumped default ktlint from
0.43.0
to0.43.2
. - Converted
ktlint
integration to use a compile-only source set. (#524)
- Added
named
option tolicenseHeader
to support alternate license header within same format (like java) (872). - Added
onlyIfContentMatches
option tolicenseHeader
to skip license header application based on source file content pattern (#650). - Bump jgit version (#992).
- jgit
5.10.0.202012080955-r
->5.13.0.202109080827-r
- jgit
DiffMessageFormatter
can now generate messages based on a folder of cleaned files, as an alternative to aFormatter
(#982).
- Fix CI and various spotbugs nits (#988).
- Bump default formatter versions (#989)
- google-java-format
1.11.0
->1.12.0
- ktlint
0.42.1
->0.43.0
- ktfmt
0.27
->0.29
- scalafmt
3.0.0
->3.0.8
- google-java-format
- Added support and bump Eclipse formatter default versions to
4.21
foreclipse-groovy
. Change is only applied for JVM 11+. - Added support for ktlint's FilenameRule (#974).
- Temporary workspace deletion for Eclipse based formatters on JVM shutdown (#967). Change is only applied for Eclipse versions using JVM 11+, no back-port to older versions is planned.
- module-info formatting in
eclipse-jdt
versions4.20
and4.21
. Note that the problem also affects older versions. - Added workaround to support projects using git worktrees (#965)
- Added
wildcardsLast
option for JavaImportOrderStep
(#954)
- Added support for JBDI bind list params in sql formatter (#955)
- Added support for custom JSR223 formatters (#945)
- Added support for formatting and sorting Maven POMs (#946)
- Added support for calling local binary formatters (#949)
- Added support and bump Eclipse formatter default versions to
4.21
foreclipse-cdt
,eclipse-jdt
,eclipse-wtp
. Change is only applied for JVM 11+. - Added
groupArtifact
option forgoogle-java-format
(#944)
- Added support and bump Eclipse formatter default versions for JVM 11+. For older JVMs the previous defaults remain.
eclipse-cdt
from4.16
to4.20
eclipse-groovy
from4.19
to4.20
eclipse-jdt
from4.19
to4.20
eclipse-wtp
from4.18
to4.20
- Added support for
google-java-format
'sskip-reflowing-long-strings
option (#929)
- Added support for scalafmt 3.0.0 and bump default scalafmt version to
3.0.0
(#913). - Bump default versions (#915)
ktfmt
from0.24
to0.27
ktlint
from0.35.0
to0.42.1
google-java-format
from1.10.0
to1.11.0
- Fix javadoc publishing (#916 fixes #775).
- Improved SQL formatting with respect to comments
- Improved exception messages for JSON formatting failures
- Added formatter for JVM-based JSON formatting
- Added Gradle configuration JVM-based JSON formatting
- Added support for
eclipse-cdt
at4.19.0
. Note that version requires Java 11 or higher. - Added support for
eclipse-groovy
at4.18.0
and4.19.0
. - Added support for
eclipse-wtp
at4.19.0
. Note that version requires Java 11 or higher.
- Bump
eclipse-groovy
default version from4.17.0
to4.19.0
.
- Update ktfmt from 0.21 to 0.24
- The
<url>
field in the Maven POM is now set correctly (#798) - Node is re-installed if some other build step removed it (#863)
- Explicitly separate target file from git arguments when parsing year for license header to prevent command from failing on argument-like paths (#847)
- LicenseHeaderStep treats address as copyright year (#716)
- Fix license header bug for years in range (#840).
- Update default google-java-format from 1.9 to 1.10.0
- Expose configuration exceptions from scalafmt (#837)
- Bump ktfmt to 0.21 and add support to Google and Kotlinlang formats (#812)
- Allow licence headers to be blank (#801).
- Support for diktat (#789)
- Added support for
eclipse-cdt
,eclipse-jdt
, andeclipse-wtp
at4.18.0
.
- Bump
eclipse-jdt
default version from4.17.0
to4.18.0
. - Bump
eclipse-wtp
default version from4.17.0
to4.18.0
. - Bump
ktfmt
default version from0.16
to0.19
(#748 and #773). - Bump
jgit
from5.9
to5.10
(#773).
- Fixed
ratchetFrom
support for git-submodule (#746). - Fixed
ratchetFrom
excess memory consumption (#735). ktfmt
v0.19+ with dropbox-style works again (#765).prettier
no longer throws errors on empty files (#751).- Fixed error when running on root of windows mountpoint (#760).
- Fixed typo in javadoc comment for SQL_FORMATTER_INDENT_TYPE (#753).
- Fixed a bug which occurred if the root directory of the project was also the filesystem root (#732)
- Bump JGit from
5.8.0
to5.9.0
to improve performance (#726)
- Added support to npm-based steps for picking up
.npmrc
files (#727)
- Added support for eclipse-cdt 4.14.0, 4.16.0 and 4.17.0 (#722).
- Added support for eclipse-groovy 4.14.0, 4.15.0, 4.16.0 and 4.17.0 (#722).
- Added support for eclipse-jdt 4.17.0 (#722).
- Added support for eclipse-wtp 4.14.0, 4.15.0, 4.16.0 and 4.17.0 (#722).
- Updated default eclipse-cdt from 4.13.0 to 4.16.0 (#722). Note that version 4.17.0 is supported, but requires Java 11 or higher.
- Updated default eclipse-groovy from 4.13.0 to 4.17.0 (#722).
- Updated default eclipse-jdt from 4.16.0 to 4.17.0 (#722).
- Updated default eclipse-wtp from 4.13.0 to 4.17.0 (#722).
- Exposed new methods in
GitRatchet
to support faster ratcheting in the Maven plugin (#706).
PipeStepPair.Builder
now has a method.buildStepWhichAppliesSubSteps(Path rootPath, Collection<FormatterStep> steps)
, which returns a singleFormatterStep
that applies the given steps within the regex defined earlier in the builder. Used for formatting inception (implements #412).
- Don't assume that file content passed into Prettier is at least 50 characters (#699).
- Improved JRE parsing to handle strings like
16-loom
(fixes #693).
PipeStepPair
which allows extracting blocks of text in one step, then injecting those blocks back in later. Currently only used forspotless:off
spotless:on
, but could also be used to apply different steps in different places (#691).
- When applying license headers for the first time, we are now more lenient about parsing existing years from the header (#690).
GoogleJavaFormatStep.defaultVersion()
now returns1.9
on JDK 11+, while continuing to return1.7
on earlier JDKs. This is especially helpful toRemoveUnusedImportsStep
, since it always uses the default version of GJF (fixes #681).
- We now run all tests against JDK 8, JDK 11, and also JDK 14 (#684).
- We had test files in
testlib/src/main/resources
namedmodule-info.java
andpackage-info.java
. They cause problems for the Eclipse IDE trying to interpret them literally. Added.test
suffix to the filenames so that eclipse doesn't barf on them anymore (#683).
- Added support for eclipse-jdt 4.14.0, 4.15.0 and 4.16.0 (#678).
- Updated default eclipse-jdt from 4.13.0 to 4.16.0 (#678).
- The ability to shell out to formatters with their own executables. (#672)
ProcessRunner
makes it easy to efficiently and debuggably call foreign executables, and pipe their stdout and stderr to strings.ForeignExe
finds executables on the path (or other strategies), and confirms that they have the correct version (to facilitate Spotless' caching). If the executable is not present or the wrong version, it points the user towards how to fix the problem.- These classes were used to add support for python black and clang-format.
- Incidental to this effort,
FormatterFunc.Closeable
now has new methods which make resource-handling safer. The old method is still available asofDangerous
, but it should not be used outside of a testing situation. There are some legacy usages ofofDangerous
in the codebase, and it would be nice to fix them, but the existing usages are using it safely.
KtLintStep
is now more robust when parsing version string for version-dependent implementation details, fixes #668.
FormatterFunc.Closeable
had a "use after free" bug which caused errors in the npm-based formatters (e.g. prettier) ifspotlessCheck
was called on dirty files. (#651)
- Bump default ktfmt from
0.15
to0.16
, and remove duplicated logic for the--dropbox-style
option (#642)
- Bump default ktfmt from 0.13 to 0.15, and add support for the --dropbox-style option (#641).
FileSignature.machineIsWin()
, to replace the now-deprecatedLineEnding.nativeIsWin()
, because it turns out that\r\n
is not a reliable way to detect the windows OS (#639).
GitAttributesLineEndings
was fatally broken (always returned platform default), and our tests missed it because they tested the part before the broken part (#639).
LineEnding.GIT_ATTRIBUTES
now creates a policy whose serialized state can be relocated from one machine to another. No user-visible change, but paves the way for remote build cache support in Gradle. (#621)
prettier
will now autodetect the parser (and formatter) to use based on the filename, unless you override this usingconfig
orconfigFile
with the optionparser
orfilepath
. (#620)GitRatchet
now lives inlib-extra
, and is shared acrossplugin-gradle
andplugin-maven
(#626).- Added ANTLR4 support (#326).
FormatterFunc.NeedsFile
for implementing file-based formatters more cleanly than we have so far (#637).
- BREAKING
FileSignature
can no longer sign folders, only files. Signatures are now based only on filename (not path), size, and a content hash. It throws an error if a signature is attempted on a folder or on multiple files with different paths but the same filename - it never breaks silently. This change does not break any of Spotless' internal logic, so it is unlikely to affect any of Spotless' consumers either. (#571) - BREAKING
FormatterFunc
no longerextends ThrowingEx.Function
andBiFunction
. In a major win for Java's idea of "target typing", this required no changes anywhere in the codebase except deleting theextends
part ofFormatterFunc
(#638). - BREAKING Heavy refactor of the
LicenseHeaderStep
public API. Doesn't change internal behavior, but makes implementation of the Gradle and Maven plugins much easier. (#628) - BREAKING Removed all deprecated methods and classes from
lib
andlib-extra
.
- Nodejs-based formatters
prettier
andtsfmt
now use native node instead of the J2V8 approach. (#606)- This removes the dependency to the no-longer-maintained Linux/Windows/macOs variants of J2V8.
- This enables spotless to use the latest
prettier
versions (instead of being stuck at prettier version <=1.19.0
) - Bumped default versions, prettier
1.16.4
->2.0.5
, tslint5.12.1
->6.1.2
- Our main branch is now called
main
. (#613)
LicenseHeaderStep.setLicenseHeaderYearsFromGitHistory
, which does an expensive search through git history to determine the oldest and newest commits for each file, and uses that to determine license header years. (#604)
- We are now running CI on windows. (#596)
- We are now dogfooding
ratchetFrom
andlicenseHeader
with a$YEAR
token to ensure that Spotless copyright headers stay up-to-date without adding noise to file history. (#595) - Added
LineEnding.nativeIsWin()
,FileSignature.pathNativeToUnix()
, andFileSignature.pathUnixToNative()
, along with many API-invisible fixes and cleanup. (#592)
LicenseHeaderStep
now has anupdateYearWithLatest
parameter which can update copyright headers to today's date. (#593)- Parsing of existing years from headers is now more lenient.
- The
LicenseHeaderStep
constructor is now public, which allows capturing its state lazily, which is helpful for setting defaults based onratchetFrom
.
NodeJsGlobal.setSharedLibFolder
allows to set the location of nodejs shared libs. (#586)PaddedCell.isClean()
returns the instance ofPaddedCell.DirtyState
which represents clean. (#590)
- Previously, the nodejs-based steps would throw
UnsatisfiedLinkError
if they were ever used from more than one classloader. Now they can be used from any number of classloaders (important for Gradle build daemon). (#586)
PaddedCell.calculateDirtyState
is now defensive about misconfigured character encoding. (#575)
PaddedCell.DirtyState::writeCanonicalTo(File)
can now create a new file if necessary (previously required to overwrite an existing file) (#576).
PaddedCell.calculateDirtyState(Formatter, File, byte[])
to allow IDE integrations to send dirty editor buffers.
- Support for google-java-format 1.8 (including test infrastructure for Java 11). (#562)
- Improved PaddedCell such that it is as performant as non-padded cell - no reason not to have it always enabled. Deprecated all of
PaddedCellBulk
. (#561) - Support for ktfmt 0.13 (#569)
- Updated a bunch of dependencies, most notably: (#564)
- jgit
5.5.0.201909110433-r
->5.7.0.202003110725-r
- Gradle
6.2.2
->6.3
- spotbugs Gradle plugin
2.0.0
->4.0.8
- jgit
- Javadoc for the
ext/eclipse-*
projects. - Replace the deprecated
compile
withimplementation
for theext/eclipse-*
projects.
- Enable IntelliJ-compatible token
$today.year
for specifying the year in license header files. (#542)
- Eclipse-WTP formatter (web tools platform, not java) could encounter errors in parallel multiproject builds #492. Fixed for Eclipse-WTP formatter Eclipse version 4.13.0 (default version).
- All
CHANGES.md
are now in keepachangelog format. (#507) - We now use javadoc.io instead of github pages. (#508)
- We no longer publish
-SNAPSHOT
for every build tomain
, since we have good JitPack integration. (#508) - Improved how we use Spotless on itself. (#509)
- Fix build warnings when building on Gradle 6+, bump build Gradle to 6.2.2, and fix javadoc links. (#536)
- Ignored
KtLintStepTest
, because gradle/gradle#11752 is causing too many CI failures. (#499)- Also fixed a minor problem in TestProvisioner.
- If you set the environment variable
SPOTLESS_EXCLUDE_MAVEN=true
then the Maven plugin will be excluded from the build. (#502)- We have set this in JitPack, as a workaround for jitpack/jitpack.io#4112
- Deprecated
SpotlessCache.clear()
in favor of the newSpotlessCache.clearOnce(Object key)
. (#501)
- Revert the change in console display of errors from 1.26.0 (#485) because of these problems.
- Bugfix: Fix NPE in EclipseXmlFormatterStepImpl (#489)
- Fix project URLs in poms. (#478)
- Fix
ImportSorter
crashing with empty files. (#474)- Fixes #305 StringIndexOutOfBoundsException for empty Groovy file when performing importOrder
- Bugfix: CDT version
4.12.0
now properly uses9.8
, whereas before it used9.7
. (#482) - Add support for Eclipse 4.13 and all related formatters (JDT, CDT, WTP, and Groovy). (#480)
- Bump default version of KtLint from
0.34.2
to0.35.0
. (#473) - Several improvements to the console display of formatting errors. (#465)
- Automatically configure import order for IntelliJ IDEA with
.editorconfig
(#486)
- Add support for ktlint
0.34+
, and bump default version from0.32.0
to0.34.2
. (#469)
- Update jgit from
5.3.2.201906051522-r
to5.5.0.201909110433-r
. (#445)- Fixes #410 AccessDeniedException in MinGW/ GitBash.
- Also fixes occasional hang on NFS due to filesystem timers.
- Eclipse-based formatters used to leave temporary files around (#447). This is now fixed, but only for eclipse 4.12+, no back-port to older Eclipse formatter versions is planned. (#451)
PaddedCellBulk
had a bug where badly-formatted files with well-behaving formatters were being:- correctly formatted by "apply"
- but incorrectly marked as good by "check"
- this led to "check" says all good, but then "apply" still causes format (#453)
- combined with up-to-date checking, could lead to even more confusing results (#338)
- only affects the Gradle plugin, since that was the only plugin to use this feature
- Minor change to
TestProvisioner
, which should fix the cache-breaking issues, allowing us to speed-up the CI builds a bit. - Bumped
scalafmt
default version from1.1.0
to2.0.1
, since there are bugs in the old default (#458).
- Fixes class loading issue with Java 9+ (#426).
- Updated default eclipse-wtp from 4.8.0 to 4.12.0 (#423).
- Updated default eclipse-groovy from 4.10 to 4.12.0 (#423).
- Updated default eclipse-jdt from 4.11.0 to 4.12.0 (#423).
- Updated default eclipse-cdt from 4.11.0 to 4.12.0 (#423).
- KNOWN BUG - accidentally published CDT 9.7 rather than 9.8 - fixed in 1.26.0
- Added new Maven coordinates for scalafmt 2.0.0+, maintains backwards compatability (#415)
- Fixes incorrect M2 cache directory path handling of Eclipse based formatters (#401)
- Update jgit from
4.9.0.201710071750-r
to5.3.2.201906051522-r
because Gradle project is sometimes broken byapache httpcomponents
in transitive dependency. (#407)
- Updated default ktlint from 0.21.0 to 0.32.0, and Maven coords to com.pinterest (#394)
- Updated default eclipse-cdt from 4.7.3a to 4.11.0 (#390).
- Fixes incorrect plugin and pom metadata in
1.21.0
(#388).
- We now use a remote build cache to speed up CI builds. Reduced build time from ~13 minutes to as low as ~3 minutes, dependending on how deep the change is (#380).
- Updated default eclipse-wtp from 4.7.3b to 4.8.0 (#382).
- Updated default eclipse-groovy from 4.8.1 to 4.10.0 (#382).
- Updated default eclipse-jdt from 4.10.0 to 4.11.0 (#384).
- Made npm package versions of
prettier
andtsfmt
(and its internal packages) configurable. (#363)- Updated default npm package version of
prettier
from 1.13.4 to 1.16.4 - Updated default npm package version of internally used typescript package from 2.9.2 to 3.3.3 and tslint package from 5.1.0 to 5.12.0 (both used by
tsfmt
)
- Updated default npm package version of
- Updated default eclipse-wtp from 4.7.3a to 4.7.3b (#371).
- Configured
build-scan
plugin in build (#356).- Runs on every CI build automatically.
- Users need to opt-in on their local machine.
- Default behavior of XML formatter changed to ignore external URIs (#369).
- WARNING RESOLVED: By default, xml formatter no longer downloads external entities. You can opt-in to resolve external entities by setting resolveExternalURI to true. However, if you do opt-in, be sure that all external entities are referenced over https and not http, or you may be vulnerable to XXE attacks.
WARNING: xml formatter in this version may be vulnerable to XXE attacks, fixed in 1.20.0 (see #358).
- Security fix: Updated groovy, c/c++, and eclipse WTP formatters so that they download their source jars securely using
https
rather thanhttp
(#360). - Updated default eclipse-jdt from 4.9.0 to 4.10.0 (#368)
WARNING: xml formatter in this version may be vulnerable to XXE attacks, fixed in 1.20.0 (see #358).
- CSS and XML extensions are discontinued (#325).
- Provided features with access to SLF4J interface of build tools. (#236)
- Updated default google-java-format from 1.5 to 1.7 (#335).
ImportOrderStep.createFromFile
is now lazy (#218).
WARNING: xml formatter in this version may be vulnerable to XXE attacks, fixed in 1.20.0 (see #358).
- Updated default eclipse-jdt from 4.7.3a to 4.9.0 (#316). New version addresses enum-tab formatting bug in 4.8 (#314).
WARNING: xml formatter in this version may be vulnerable to XXE attacks, fixed in 1.20.0 (see #358).
- Minor support for plugin-gradle and plugin-maven CSS plugins (#311).
WARNING: xml formatter in this version may be vulnerable to XXE attacks, fixed in 1.20.0 (see #358).
- Added C/C++ support (#232).
- Integrated Eclipse CDT formatter (#274)
- Extended dependency provisioner to exclude transitives on request (#297).This prevents unnecessary downloads of unused transitive dependencies for Eclipse based formatter steps.
- Updated default groovy-eclipse from 4.8.0 to 4.8.1 (#288). New version is based on Groovy-Eclipse 3.0.0.
- Integrated Eclipse WTP formatter (#290)
- Updated JSR305 annotation from 3.0.0 to 3.0.2 (#274)
- Migrated from FindBugs annotations 3.0.0 to SpotBugs annotations 3.1.6 (#274)
Formatter
now implementsAutoCloseable
. This means that users ofFormatter
are expected to use the try-with-resources pattern. The reason for this change is so thatFormatterFunc.Closeable
actually works. (#284)* Addedprettier
andtsfmt
support, as well as general infrastructure for callingnodeJS
code usingj2v8
(#283).
- Updated default groovy-eclipse from 4.6.3 to 4.8.0 (#244). New version allows to ignore internal formatter errors/warnings.
- Updated default eclipse-jdt from 4.7.2 to 4.8.0 (#239). New version fixes a bug preventing Java code formatting within JavaDoc comments (#191).
- Eclipse formatter versions decoupled from Spotless formatter step implementations to allow independent updates of maven-based Eclipse dependencies. (#253)
- Use guaranteed binary and source compatibility between releases of Scalafmt. (#260)
- Add line and column numbers to ktlint errors. (#251)
- Fixed a bug in
LicenseHeaderStep
which caused an exception with some malformed date-aware licenses. (#222) - Updated default ktlint from 0.14.0 to 0.21.0
- Add ability to pass custom options to ktlint in Gradle plugin. See plugin-gradle/README for details.
- Added default indentation of
4
toIndentStep
. (#209)
- LicenseHeaderStep now supports customizing the year range separator in copyright notices. (#199)
- Breaking change to testlib - removed
ResourceHarness.write
and addedResourceHarness.[set/assert]File
for easier-to-read tests. (#203)
- Updated default ktlint from 0.6.1 to 0.14.0
- Updated default google-java-format from 1.3 to 1.5
- Updated default eclipse-jdt from 4.7.1 to 4.7.2
- Added a configuration option to
googleJavaFormat
to switch the formatter style (#193)
- LicenseHeaderStep now supports time-aware copyright notices in license headers. (#179, thanks to @baptistemesta)
- Updated default eclipse-jdt version to
4.7.1
from4.6.3
. - Updated jgit from
4.5.0.201609210915-r
to4.9.0.201710071750-r
. - Updated concurrent-trees from
2.6.0
to2.6.1
(performance improvement). - Added
dbeaverSql
formatter step, for formatting sql scripts. (#166)- Many thanks to Baptiste Mesta for porting to Spotless.
- Many thanks to DBeaver and the DBeaver contributors for building the implementation.
- Added
public static boolean PaddedCell::applyAnyChanged(Formatter formatter, File file)
.
- Added
KtLintStep.createForScript
.
- Deprecated
ImportOrderStep.createFromOrder(List<String>
in favor of(String...
.
- Default eclipse version for
EclipseFormatterStep
bumped to4.6.3
from4.6.1
. (#116) - Default scalafmt version for
ScalaFmtStep
bumped to1.1.0
from0.5.7
(#124)- Also added support for the API change to scalafmt introduced in
0.7.0-RC1
- Also added support for the API change to scalafmt introduced in
ImportOrderStep
can now handle multi-line comments and misplaced imports.- Especially helpful for Groovy and Gradle files.
- Fixed a bug in
PaddedCellBulk.check()
which caused acheck
to fail even after anapply
for cases which caused CYCLE.
- Added support for Groovy via greclipse.
- When a JarState resolution failed, it threw a Gradle-specific error message. That message has been moved out of
lib
and intoplugin-gradle
where it belongs.
- Deprecated
FileSignature.from
in favor ofFileSignature.signAsSet
and the newFileSignature.signAsList
. - Added a
FormatterProperties
class which loads.properties
files and eclipse-style.xml
files. SerializableFileFilter.skipFilesNamed
can now skip multiple file names.- Update default KtLint from 0.3.1 to 0.6.1.
- This means we no longer look for rules in the typo package
com.gihub.shyiko
, now only incom.github.shyiko
(note thet
).
- This means we no longer look for rules in the typo package
- Added support for Scala via scalafmt.
- Added support for Kotlin via ktlint.
- Better error messages for JarState.
- Improved test harnessing.
- Formatter now has pluggable exception policies,
- Initial release!