Skip to content

Conversation

@Subham-KRLX
Copy link
Contributor

Did you read the Contributor Guide?
Yes, I have read the Contributor Rules and Contributor Development Guide.

Is this PR related to a ticket?
Yes, and the PR name follows the format [GH-2189] Add Checkstyle pre-commit hook for Java.
Closes #2189.

What changes were proposed in this PR?
This PR adds a Checkstyle pre-commit hook to automatically check Java code formatting and style consistency before each commit.
The hook runs mvn checkstyle:check to detect style violations. Since Spotless already formats Scala code, no new hooks were added for Scala files.

Key changes:

Added Checkstyle configuration to .pre-commit-config.yaml

Integrated it into the existing pre-commit workflow for Java sources

Ensured compatibility with current Maven/Spotless setup

Why are these changes needed?
To improve and enforce Java code style consistency during development. Automating the style check helps contributors detect and fix formatting issues early, ensuring clean and maintainable code before review and CI builds.

How was this patch tested?
Installed pre-commit hooks locally and verified execution

Ran pre-commit run --all-files to confirm the Checkstyle hook triggers correctly

Intentionally introduced style violations to verify detection

Confirmed normal commits proceed when no issues are found

Does this PR include necessary documentation updates?
No, this PR affects only development tooling and does not modify user-facing APIs or documentation.

Does this PR introduce any user-facing changes?
No user-facing changes. This only affects local development workflow.

@Subham-KRLX Subham-KRLX force-pushed the feature/add-checkstyle-hook branch from f4ee58b to 0366d4c Compare November 15, 2025 04:50
@jbampton jbampton marked this pull request as draft November 17, 2025 10:27
@Subham-KRLX Subham-KRLX marked this pull request as ready for review November 19, 2025 16:16
@Subham-KRLX
Copy link
Contributor Author

@jbampton please review this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A list of the top Java and / or Scala tools that can be wrapped as pre-commit hooks. Gemini can make mistakes, so double-check it

1 participant