-
Notifications
You must be signed in to change notification settings - Fork 64
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
Automatic code formatting using Spotless #1374
Conversation
8c24ead
to
ee413e0
Compare
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.
Looks great! Left some comments.
This is necessary in order to pass the formatting check in CI.
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.
Only minor nitpicks
98e4c81
to
281ce00
Compare
281ce00
to
65fd352
Compare
I noticed that this PR created a new top-level directory |
I do not think it would be a good idea to get rid of
Also, regarding this particular
So in short, the my general approach to the problem at hand was a little weird -- I wrote Java code that executes a JAR that has to be built separately in order to avoid a circular dependency. However, unless/until we decide to use an entirely different strategy, it is indeed appropriate to keep the code in Edit: I should also mention that |
Ok, I understand now what buildSrc means. Thanks for explaining. So ideally we would move all the I guess invoking the jar is part of the reason why formatting can be slow. I don't quite see the circular dependency though. Could you explain a bit? Since we refactor the repo and the build anyway, we should aim at resolving this problem in the process. |
Well, there is no circular dependency, but if |
Ok, I see now. Thanks! |
I have gotten feedback from multiple people that the requirement that LF tests be formatted has the potential to be annoying if it is not documented properly (and perhaps automated or hooked into some established workflow).
Unfortunately, using client-side Git hooks for the formatter seems like it would require each person to manually add the Git hook (for some reason, client-side Git hooks apparently cannot be tracked). If we were to use a server-side Git hook, then people would find out about formatting problems after they have already pushed their work, which can be annoying.
Because there has already been plenty of talk about adding Spotless to our regular workflow (#1052), it seems to me like the overhead of dealing with formatting tools can be minimized by just using the Spotless Gradle plugin for both LF formatting and Java formatting.
If we cannot quickly reach consensus about Java formatting, I propose to comment Java formatting out of this PR so that we at least have an established way of invoking
lff
. Otherwise, people would have to get used to directly invoking therunLff
task, and then when we have a Java formatter or linter, they would have to get used to that again. Additionally, Spotless has advantages over direct invocation of the formatter. For example, it only runs the formatter on files that have changed.Development of a comprehensive
CONTRIBUTING.md
file and building of consensus around coding standards have already been started in #478; therefore, they are both non-goals of this PR.