-
Notifications
You must be signed in to change notification settings - Fork 28
refactor: replace binary validation tools with Maven-based checkstyle workflow #81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
refactor: replace binary validation tools with Maven-based checkstyle workflow #81
Conversation
WalkthroughThis update restructures the Checkstyle GitHub Actions workflow, making it self-contained with detailed steps for Java setup, file change detection, Maven caching, and explicit Checkstyle execution. The commit lint workflow now runs both Changes
Sequence Diagram(s)sequenceDiagram
participant GitHub PR
participant Checkstyle Workflow
participant Runner (ubuntu-latest)
participant Maven
participant Checkstyle
GitHub PR->>Checkstyle Workflow: PR event (opened/synchronize/reopened) or workflow_call
Checkstyle Workflow->>Runner (ubuntu-latest): Start job
Runner (ubuntu-latest)->>Runner (ubuntu-latest): Checkout repo, setup JDK 17
Runner (ubuntu-latest)->>Runner (ubuntu-latest): Detect changed Java/XML files
Runner (ubuntu-latest)->>Runner (ubuntu-latest): Cache Maven dependencies
Runner (ubuntu-latest)->>Maven: Install dependencies (skip tests)
alt Changed files exist
Runner (ubuntu-latest)->>Checkstyle: Run Checkstyle on changed files
Checkstyle-->>Runner (ubuntu-latest): Report results
alt Checkstyle fails
Runner (ubuntu-latest)->>Checkstyle Workflow: Mark workflow as failed, block PR
end
end
Poem
Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. Note ⚡️ Faster reviews with cachingCodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (7)
.github/workflows/commit-lint.yml (2)
26-29
: Avoid redundant dependency installation commands.The workflow runs both
npm ci --legacy-peer-deps
andnpm i --legacy-peer-deps
. Typicallynpm ci
is sufficient for installing locked dependencies; runningnpm install
immediately after may be redundant and slows down CI. Consider consolidating to a single command or documenting why both are needed.
34-34
: Add newline at end of file.YAML workflows conventionally end with a newline to satisfy linters and maintain clean diffs.
🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 34-34: no new line character at the end of file
(new-line-at-end-of-file)
.github/workflows/checkstyle.yml (5)
24-25
: Remove trailing whitespace.YAML lint flags trailing spaces on these lines; please delete the extra spaces to keep the file clean.
🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 24-24: trailing spaces
(trailing-spaces)
[error] 25-25: trailing spaces
(trailing-spaces)
26-31
: Pin Java distribution to Temurin (optional).Using
distribution: 'adopt'
still works, but the recommended alias upstream is now'temurin'
. You may future-proof this by switching to:distribution: 'temurin'🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 31-31: trailing spaces
(trailing-spaces)
37-44
: Consider a lighter Maven goal for style checks.Running
mvn install -DskipTests
populates the local repo but may not be necessary for Checkstyle. A quicker alternative is:mvn validateor
mvn compilewhich still loads Checkstyle without installing artifacts.
🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 37-37: trailing spaces
(trailing-spaces)
[error] 44-44: trailing spaces
(trailing-spaces)
31-31
: Remove trailing whitespace.Several lines have trailing spaces flagged by YAMLlint. Please strip these to satisfy linting rules.
Also applies to: 37-37, 44-44, 47-47
🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 31-31: trailing spaces
(trailing-spaces)
63-63
: Add newline at end of file.Ensure the workflow file ends with a newline character to comply with POSIX and YAML best practices.
🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 63-63: no new line character at the end of file
(new-line-at-end-of-file)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting
📒 Files selected for processing (3)
.github/workflows/checkstyle.yml
(1 hunks).github/workflows/commit-lint.yml
(1 hunks)package.json
(2 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.github/workflows/commit-lint.yml
[error] 34-34: no new line character at the end of file
(new-line-at-end-of-file)
.github/workflows/checkstyle.yml
[error] 12-12: trailing spaces
(trailing-spaces)
[error] 19-19: trailing spaces
(trailing-spaces)
[error] 24-24: trailing spaces
(trailing-spaces)
[error] 25-25: trailing spaces
(trailing-spaces)
[error] 31-31: trailing spaces
(trailing-spaces)
[error] 37-37: trailing spaces
(trailing-spaces)
[error] 44-44: trailing spaces
(trailing-spaces)
[error] 47-47: trailing spaces
(trailing-spaces)
[error] 63-63: no new line character at the end of file
(new-line-at-end-of-file)
🔇 Additional comments (9)
package.json (1)
15-18
: Verify lint-staged patterns cover all intended file types.The update restricts lint-staged to
src/**/*.{ts,js}
, removing CSS and HTML from auto-fix. Ensure CSS/HTML files are still linted or formatted elsewhere; otherwise consider adding separate patterns or workflows to cover them..github/workflows/commit-lint.yml (1)
32-34
: Approve commitlint invocation formatting.Splitting the
--from
,--to
, and--verbose
flags across lines increases readability and reduces risk of syntax errors. Good improvement.🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 34-34: no new line character at the end of file
(new-line-at-end-of-file)
.github/workflows/checkstyle.yml (7)
1-1
: Clarify workflow name.Renaming to
Checkstyle
makes its purpose crystal-clear in the GitHub Actions UI.
5-6
: Broaden PR trigger events.Switching to
opened
,synchronize
, andreopened
ensures style checks run on initial and updated PRs. This aligns with typical development workflows.
6-11
: Enable external invocation with Java version input.Introducing a
workflow_call
input (java-version
) adds flexibility for downstream workflows to specify alternate JDK versions.
14-19
: Enforce least-privilege permissions.Specifying
contents: read
andpull-requests: write
follows security best practices by limiting token scope to only what the job requires.🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 19-19: trailing spaces
(trailing-spaces)
32-34
: Efficient changed-file detection.Leveraging
tj-actions/changed-files@v39
with a**/*.java,**/*.xml
filter ensures only relevant files are checked, speeding up CI.
48-57
: Verify Checkstyle include-file syntax.Passing
-Dcheckstyle.includes=@changed_files.txt
depends on the plugin’s support for@
-prefixed file lists. Please confirm that this approach correctly picks up modified files; if not, you may need to read the file into a property or expand the includes on the command line.
58-63
: Explicit PR blocking on failure.Using
actions/github-script
to callcore.setFailed
with a clear message ensures that style violations halt the PR. This explicit failure handling improves developer feedback.🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 63-63: no new line character at the end of file
(new-line-at-end-of-file)
📋 Description
JIRA ID:
Previously, we were using a binary tool (
xmllint
) viapackage.json
to handle XML validation. Based on feedback from the maintainer, I've replaced that setup with a Maven-based approach that integrates better with the existing project tooling.What’s changed:
checkstyle.yml
workflow that runs on pull requests.xmllint
configuration frompackage.json
.checkstyle.xml
.This update removes the need for binary executables in the repo and keeps everything within the Maven ecosystem, making it cleaner and easier to maintain.
✅ Type of Change
ℹ️ Additional Information
Summary by CodeRabbit