-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spotless
formatting
#2524
Spotless
formatting
#2524
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this is very helpful! Just a few comments. If mvn verify
passes then I think this should be good.
I thought the same thing, also because the documentation says:
Until, I executed: |
Well, can you temporarily introduce a deliberate formatting error into the PR, and verify that the CI fails? |
Moves the `spotless` plugin out of `<pluginManagement>`
For the first time, I'm happy that CI fails 🤣 I will run |
<formats> | ||
<format> | ||
<includes> | ||
<include>*.md</include> | ||
<include>.gitignore</include> | ||
</includes> | ||
<trimTrailingWhitespace/> | ||
<endWithNewline/> | ||
<indent> | ||
<spaces>true</spaces> | ||
<spacesPerTab>4</spacesPerTab> | ||
</indent> | ||
</format> | ||
</formats> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this <formats>
section needed? If I understand it correctly that would only apply to *.md
and .gitignore
the way it is currently configured; and I am not sure if we should impose any formatting rules on them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting rules are very weak on.md
and .gitignore
. They replace tab characters with 4 spaces and trim trailing whitespace.
I think they are good general rules, but if you prefer to remove them, let me know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I just asked because this section looked like the section from the Spotless examples and it isn't needed for Java formatting.
The combination of *.md
with trimTrailingWhitespace
should be removed though because they can break Markdown formatting. Arguably the Spotless examples are also flawed (diffplug/spotless#1877).
Edit: Nevermind, if the Markdown files are consistently using a trailing \
instead of two spaces for a hard line break, then it should be fine to remove trailing whitespace. But it might be good to add a comment here mentioning that a trailing \
can be used instead of trailing whitespace in Markdown files.
I'm not sure why the |
It's great to see this progress! A couple of things. First, I think reformatting the existing files should be a separate PR from the one that adds the Spotless plugin. Second, I'm pretty sure the CI failure is because |
8047b25
to
d850f28
Compare
Make sense, I reverted the formatting commits and I will move it in a new PR (when this PR will be merged, so I can edit the |
I think you need to merge that PR first, so that you won't get errors from this one? |
All CI passed, but I think is better have a more tidy commits history.
And I'll close this PR. |
@eamonnmcmanus if possible please wait a bit with merging this (or any related formatting PR). #2531 'broke' some formatting of Markdown files which intentionally used two trailing spaces for hard line breaks, and in theory someone would have to review all the 229 files changed by the last PR (in case you haven't done so already). I can try to revert the Markdown formatting changes (and possibly any other unintentional changes), but only in the next days. |
I can do that. I will refrain from sharing my thoughts on that particular Markdown syntax, except to say that the alternative syntax with |
Thanks! I completely overlooked in the specification that a trailing Sorry that my previous comment was not that kind. I think it is great though that you both are working on making the formatting of this project consistent! |
Purpose
Adds the
Spotless
plugin to check that formatting follows the Google Java Style GuideDescription
Related with #2284
build
workflow).(I have applied some default configurations)
Checklist
null
@since $next-version$
(
$next-version$
is a special placeholder which is automatically replaced during release)TestCase
)mvn clean verify javadoc:jar
passes without errors