ctubbsii commented on PR #2581:
URL: https://github.com/apache/thrift/pull/2581#issuecomment-1117740256

   > Yes sorry I wasn't clear in the beginning. The spotless check is a 
standalone step already included into gradle build - but you can also run it on 
its own. It does the check on Java lib code that's checked into git.
   
   I understand that spotlessCheck is included into the gradle build. However, 
I'm suggesting that for it to be useful as a CI check, it needs to be run on 
its own, outside the normal gradle build.
   
   In development, we want: `gradle build` to execute `spotlessApply` so it 
formats all the code. After that, it can run `spotlessCheck` to make sure 
everything was formatted, but it's kind of redundant, because everything should 
have been formatted by the previous `spotlessApply` step. We don't expect the 
build to fail based on formatting here. But, the developer should check in any 
changed files, to include in their pull request.
   
   In the pull request CI checks, we want something different. It is not 
sufficient to simply run `gradle build`, which will run `spotlessApply` to 
format all the source code. We actually want to run `spotlessCheck` **without** 
running `spotlessApply`, because we're not trying to *format* the source code 
during CI... we're trying to *detect unformatted* source code.
   
   So, we need to run `spotlessCheck` on its own, without running `gradle 
build`, because we want to avoid running `spotlessApply` before running 
`spotlessCheck`. If we do `gradle build`, the check will always pass, and we 
will fail to detect that some files in the PR weren't formatted.
   
   Imagine that there is unformatted code in a PR. We want a CI check to ensure 
code in PRs are formatted already, so we don't merge unformatted code.
   
   As I understand it, `gradle build` will, among other things, run 
`spotlessApply`, then `spotlessCheck`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to