jdaugherty commented on PR #14903:
URL: https://github.com/apache/grails-core/pull/14903#issuecomment-3076742496

   > Instead of failing the build for checkstyle, I would suggest putting a 
githook on prepush to apply spotless ` #!/bin/sh
   > 
   > ```
   > echo "[git hook] Running Spotless apply before push..."
   > 
   > # Run spotlessApply
   > ./gradlew spotlessApply
   > 
   > # Check if there are any changes after spotlessApply
   > if ! git diff --quiet; then
   >     echo "Spotless applied changes. Creating a separate commit..."
   >     git add .
   >     git commit -m "chore: Apply Spotless formatting" --no-verify # 
--no-verify to prevent recursion
   > fi
   > 
   > # Proceed with the original push
   > exit 0`
   > ```
   > 
   > I have only used it on maven, so I can't suggest a gradle plugin
   
   I think it's reasonable to not fail the build on styling, but I do think we 
need a Github workflow that does fail if the styling is wrong.  A prehook would 
be one way to help avoid issues, but it won't avoid all of them - some of the 
checkstyle configuration isn't fixable by spotless.  For example, checkstyle 
mandates variable declarations be in  certain order by their access level & 
classes be defined at the end of a file.  
   
   What are your thoughts about this: 
   1. suggest the prehook for formatting purposes
   2. add a build that exclusively runs the checkstyle / linting (if linting 
shows anything changed, we would fail too)?
   
   You can then iterate locally and fix after the fact.


-- 
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: notifications-unsubscr...@grails.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to