-
Notifications
You must be signed in to change notification settings - Fork 7
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
[PF-1559] fix spotless & run 🏃🏻 #676
Conversation
Testing the GHA with an intentional lint failure. |
Can we make an entry in the spotless config here to skip the generated code? |
Great idea. That looks like the ticket. I'm stuck again though, because I don't understand why that annotation doesn't apply in this case for |
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.
LGTM
@@ -1,5 +1,10 @@ | |||
package bio.terra.workspace.service.resource.controlled.cloud.azure.storage; | |||
|
|||
import static org.hamcrest.MatcherAssert.assertThat; |
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.
@jaycarlton This import ordering doesn't seem to be enforced by google-java-format
, as when I reformat wit google-java-format
in IntelliJ I don't get these changes. Therefore it seems that I need to run spotless locally also. What is the command to do that, and do you know if there is a way to set up IntelliJ's formatting to automatically use spotless?
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.
To run spotless, do ./gradlew spotlessApply
after this is merged.
It's possible to set up IntelliJ so that it runs spotlessApply
every time a file is saved. @melissachang is the only one I know who's done that.
Also, import ordering seems to work for me when I let IJ handle all the imports. I.e. I never manually add an import statement, and they seem to go to the right place FWIW.
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.
Have Intellij run spotless on file save:
@@ -12,11 +12,6 @@ for (task in TASKS_ONLY_IF_COMPILE_JAVA) { | |||
task.dependsOn(compileJava.inputs.files) | |||
// If compileJava runs, this must run after it (for the following to work). | |||
task.mustRunAfter(compileJava) | |||
// Don't run if compileJava didn't do any work. This is necessary because otherwise, these |
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 related?
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.
Yeah, one fix was to make spotlessApply
, etc, actually run, and the other was to avoid running it on generated code.
Remove an over-optimization that made
spotlessApply
and its ilk rarely actually run. The first file is the only manual change.