Skip to content

fix:Checkstyle check#324

Open
msslulu wants to merge 14 commits into
opentiny:developfrom
msslulu:feat/codeCheckStyle
Open

fix:Checkstyle check#324
msslulu wants to merge 14 commits into
opentiny:developfrom
msslulu:feat/codeCheckStyle

Conversation

@msslulu

@msslulu msslulu commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

English | 简体中文

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • Built its own designer, fully self-validated

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

Background and solution

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Quality Improvements
    • Added automated Checkstyle validation to the Maven build.
    • Introduced standardized code quality rules for formatting, naming, documentation, imports, and code structure.
    • Builds now fail when Checkstyle violations are detected.
  • CI Improvements
    • Checkstyle runs on pushes and pull requests targeting develop.
    • Added caching to speed up validation.
    • Checkstyle reports are preserved and uploaded even when validation fails.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@msslulu, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 16 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 46810704-51dd-4242-a233-5ef2cdd1a295

📥 Commits

Reviewing files that changed from the base of the PR and between 3843ac1 and 3a1b0c9.

📒 Files selected for processing (1)
  • pom.xml

Walkthrough

The project adds a Huawei Checkstyle ruleset, connects it to Maven validation, and updates GitHub Actions to run Checkstyle on develop pushes and pull requests while caching Maven dependencies and uploading reports.

Changes

Checkstyle CI

Layer / File(s) Summary
Checkstyle ruleset
checkstyle/huawei-checkstyle.xml
Defines import, Javadoc, formatting, structure, naming, visibility, complexity, and size checks.
Maven Checkstyle execution
pom.xml
Configures the Checkstyle plugin to use the Huawei ruleset, run during validate, emit XML, and fail on violations.
Checkstyle workflow integration
.github/workflows/checkstyle.yml
Runs Checkstyle for develop pushes and pull requests using JDK 17, Maven caching, and unconditional report upload.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Poem

I’m a bunny with rules in my code,
Checking each hop on the build’s little road.
XML reports spring when checks run,
Cached Maven jars make the work quick and fun.
With tidy braces and warnings in sight,
The pipeline now checks style just right!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and directly matches the main change: updating the Checkstyle check and configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
.github/workflows/checkstyle.yml (1)

16-17: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Set persist-credentials: false on the checkout step.

The actions/checkout@v4 action persists the GITHUB_TOKEN in .git/config by default. Since this workflow only runs Checkstyle and uploads a report — no git push or authenticated operations needed — disabling credential persistence reduces the attack surface from the artipacked vulnerability pattern.

🔒️ Proposed fix
       - name: Checkout code
         uses: actions/checkout@v4
+        with:
+          persist-credentials: false
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/checkstyle.yml around lines 16 - 17, Add
persist-credentials: false to the actions/checkout@v4 step in the workflow so
the GITHUB_TOKEN is not stored in the repository’s Git configuration.

Source: Linters/SAST tools

pom.xml (1)

247-249: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

failOnViolation and outputFileFormat are redundant defaults.

Both true and xml are the default values for these parameters. They're harmless but add noise. Consider removing them or keeping them for explicitness — your call.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pom.xml` around lines 247 - 249, Remove the redundant default configuration
entries failOnViolation and outputFileFormat from the relevant plugin
configuration in pom.xml, unless explicitness is intentionally preferred; if
retained, no functional changes are needed.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pom.xml`:
- Line 245: Update the maven-checkstyle-plugin configuration’s configLocation
from settings/checkstyle.xml to the existing
app/src/main/resources/checkstyle.xml so the validate phase can load the
Checkstyle configuration successfully.

---

Nitpick comments:
In @.github/workflows/checkstyle.yml:
- Around line 16-17: Add persist-credentials: false to the actions/checkout@v4
step in the workflow so the GITHUB_TOKEN is not stored in the repository’s Git
configuration.

In `@pom.xml`:
- Around line 247-249: Remove the redundant default configuration entries
failOnViolation and outputFileFormat from the relevant plugin configuration in
pom.xml, unless explicitness is intentionally preferred; if retained, no
functional changes are needed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 572d9955-7827-4d0a-b874-1aa765129aee

📥 Commits

Reviewing files that changed from the base of the PR and between 0045f62 and e5cde1b.

📒 Files selected for processing (2)
  • .github/workflows/checkstyle.yml
  • pom.xml

Comment thread pom.xml Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@codestyle/huawei-codestyle.xml`:
- Around line 6-9: Change the Checker-level severity in the codestyle
configuration from warning to error so inherited rule violations meet the Maven
plugin’s default violationSeverity and cause CI failure; alternatively,
configure violationSeverity to warning in the Maven plugin, but prefer updating
the Checker property.
- Around line 248-250: Move the LineLength module out of TreeWalker and place it
directly under the Checker module alongside FileLength in huawei-codestyle.xml,
preserving its max value of 200 so Checkstyle 10.x initializes successfully.
- Around line 1-287: Update the Maven Checkstyle configuration referenced by the
pom.xml Checkstyle plugin so its configLocation points to the existing
huawei-codestyle.xml ruleset under codestyle, or provide a file at the currently
referenced location with equivalent contents; ensure the Maven Checkstyle step
can successfully load the ruleset.
- Around line 67-77: Update the JavadocMethod configuration in
huawei-codestyle.xml for Checkstyle 9.3 compatibility: remove
allowUndeclaredRTE, allowThrowsTagsForSubclasses, and allowMissingThrowsTags,
retain allowMissingPropertyJavadoc, and use the supported validateThrows
property to configure throws-tag validation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a04de165-4ee2-4668-a6dd-4913424bdf1b

📥 Commits

Reviewing files that changed from the base of the PR and between e5cde1b and 95b5fb3.

📒 Files selected for processing (2)
  • codestyle/huawei-codestyle.xml
  • pom.xml
🚧 Files skipped from review as they are similar to previous changes (1)
  • pom.xml

Comment thread checkstyle/huawei-checkstyle.xml
Comment thread checkstyle/huawei-checkstyle.xml Outdated
Comment thread checkstyle/huawei-checkstyle.xml
Comment thread checkstyle/huawei-checkstyle.xml Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
checkstyle/huawei-checkstyle.xml (1)

57-66: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Fix the Checkstyle configuration errors

  • JavadocMethod still uses unsupported properties: allowMissingThrowsTags, allowUndeclaredRTE, and allowThrowsTagsForSubclasses.
  • LineLength is still nested under TreeWalker; it needs to be a direct child of Checker.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@checkstyle/huawei-checkstyle.xml` around lines 57 - 66, Update the Checkstyle
configuration by removing the unsupported allowMissingThrowsTags,
allowUndeclaredRTE, and allowThrowsTagsForSubclasses properties from the
JavadocMethod module. Also move the LineLength module out of TreeWalker so it is
declared directly under Checker.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@checkstyle/huawei-checkstyle.xml`:
- Around line 57-66: Update the Checkstyle configuration by removing the
unsupported allowMissingThrowsTags, allowUndeclaredRTE, and
allowThrowsTagsForSubclasses properties from the JavadocMethod module. Also move
the LineLength module out of TreeWalker so it is declared directly under
Checker.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 474d04aa-cc1e-42b7-81e5-3714367b8d76

📥 Commits

Reviewing files that changed from the base of the PR and between 95b5fb3 and b58e79f.

📒 Files selected for processing (2)
  • checkstyle/huawei-checkstyle.xml
  • pom.xml
🚧 Files skipped from review as they are similar to previous changes (1)
  • pom.xml

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant