[Feature]: Add Automated Java Code Formatting Check to Backend Workflow #11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixed : #10
Overview
This project enforces consistent code formatting using Spotless with Google Java Format. All Java code must adhere to the Google Java Style Guide to maintain code quality and consistency across contributions.
Automated Formatting Checks
CI/CD Enforcement
Every pull request automatically runs a formatting check in the CI pipeline. Pull requests will fail if code is not properly formatted.
The CI workflow includes:
This ensures that all merged code follows the established formatting standards.
Local Development
Check Formatting
To check if your code is properly formatted:
cd apigateway ./mvnw spotless:checkOn Windows:
cd apigateway .\mvnw.cmd spotless:checkApply Formatting
To automatically format all Java files:
cd apigateway ./mvnw spotless:applyOn Windows:
cd apigateway .\mvnw.cmd spotless:applyPre-commit Best Practice
Always run
mvnw spotless:applybefore committing your changes to avoid CI failures.What Gets Formatted
The Spotless configuration formats:
src/main/java/**/*.java)src/test/java/**/*.java)Formatting Rules Applied
java,javax,org,com,vaultweb