Enforce code formatting of changed files#230
Conversation
This commit introduces the maven spotless plugin to the project that can format the source code using "mvn spotless:apply" based on the configuration in the parent pom.xml. Also it will perform a spotless:check during the verify phase to ensure that all files are properly formatted.
|
Hi @lincolnthree, this is a suggestion on how to enforce a proper and consistent formatting of the files in the project, no matter what kind of IDE a contributor is using. I have included the eclipse code formatter rules from https://github.com/ocpsoft/common/blob/master/ocpsoft-eclipse-code-format.xml See https://github.com/diffplug/spotless/tree/main/plugin-maven on how to use the plugin. The plugin is currently configured to enforce a proper formatting only for changed files. Concerning the ratchet feature: I think it is reasonable to do a full re-format of the code in a single commit. After that any new changes/contributions will only show the important code changes (and not any unrelated formatting). I have also included a license header file that will be prepended to any java file ($YEAR will be replaced by the year spotless finds in the current header, or with the current year). I'm not sure if it makes sense to automatically add your copyright and e-mail since many file have been contributed by other authors. I leave that decision (and if you want an automatic license header at all) to you. Cheers! |
|
Hey @obecker thanks so much! Sorry for the delay. I was on vacation (got married.) I'll take a closer look at this when I can get a moment to breathe!!! This is awesome. Thank you. ~Lincoln |
b3f94df to
bbc0c21
Compare
|
After performing a full reformatting of the code base I strongly suggest adding that commit hash to Congrats on your marriage. |
This commit introduces the maven spotless plugin to the project
that can format the source code using "mvn spotless:apply" based
on the configuration in the parent pom.xml.
Also it will perform a spotless:check during the verify phase
to ensure that all files are properly formatted.