Skip to content

fix:Checkstyle check#324

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

fix:Checkstyle check#324
msslulu wants to merge 19 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 Checkstyle validation to the Maven build, including a new Checkstyle check during the validate phase.
    • Introduced a standardized Checkstyle rule set covering formatting, naming, documentation, imports, and general code structure.
    • Builds fail on Checkstyle violations and generate an XML Checkstyle report.
  • CI Improvements

    • Checkstyle now runs on push and pull requests targeting the develop branch.
    • Improved CI execution with dependency caching and always-on upload of the Checkstyle report, even when checks fail.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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 clearly matches the main change: updating Checkstyle configuration and CI checks.
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