You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Google Java Format doesn't reflow long strings #924
Using either Maven (2.12.3) or Gradle (5.14.3), with various versions of Google Java Format (including the latest, 1.11.0), Spotless doesn't reflow long strings.
Fwiw, when unused imports removal and import ordering were added (in 3.0.0, GJF being available since 2.2.0), it wasn't added as an opt-in. Though I could understand making it opt-in until the next major release.
Just wanna make sure I understand correctly. If I make a table of GJF command-line jar versions and whether they reflow strings, it would look like this:
before 1.8: does not reflow long String literals
1.8 and later: does reflow long String literals
And if I made a table of GJF in Spotless, the table would look like this:
all combinations of Spotless and GJF: does not reflow String literals
Is that correct? If so, then I think from the perspective of Spotless users, we definitely want the reflowLongStrings(false) to be the default behavior, now and in the future.
I can see a case for switching the default to match GJF in a future breaking version, so that people switching from CLI to Spotless have better defaults. But Spotless has a lot of users, and the promise we have made to them is "if you adopt us, you can think about formatting less, and when other formatters misbehave or change their defaults, we will insulate you from that." Helping people adopt is good, but most of all I want to help the people who have adopted to forget that we exist, and one way we do that is we minimize changes of defaults.
Activity
nedtwigg commentedon Sep 1, 2021
Because this would be a behavior change, it would need to be optin. E.g.
googleJavaFormat().reflowLongStrings(true). Happy to merge a PR for it.tbroyer commentedon Sep 2, 2021
Fwiw, when unused imports removal and import ordering were added (in 3.0.0, GJF being available since 2.2.0), it wasn't added as an opt-in. Though I could understand making it opt-in until the next major release.
nedtwigg commentedon Sep 2, 2021
Just wanna make sure I understand correctly. If I make a table of GJF command-line jar versions and whether they reflow strings, it would look like this:
1.8: does not reflow long String literals1.8and later: does reflow long String literalsAnd if I made a table of GJF in Spotless, the table would look like this:
Is that correct? If so, then I think from the perspective of Spotless users, we definitely want the
reflowLongStrings(false)to be the default behavior, now and in the future.I can see a case for switching the default to match GJF in a future breaking version, so that people switching from CLI to Spotless have better defaults. But Spotless has a lot of users, and the promise we have made to them is "if you adopt us, you can think about formatting less, and when other formatters misbehave or change their defaults, we will insulate you from that." Helping people adopt is good, but most of all I want to help the people who have adopted to forget that we exist, and one way we do that is we minimize changes of defaults.
tbroyer commentedon Sep 2, 2021
Yes.
Support for google-java-format's skip-reflowing-long-strings option
Support google-java-format's skip-reflowing-long-strings option