Skip to content

fix:code check plugin(Checkstyle +PMD+SpotBugs) - #324

Merged
hexqi merged 197 commits into
opentiny:developfrom
msslulu:feat/codeCheckStyle
Aug 21, 2026
Merged

fix:code check plugin(Checkstyle +PMD+SpotBugs)#324
hexqi merged 197 commits into
opentiny:developfrom
msslulu:feat/codeCheckStyle

Conversation

@msslulu

@msslulu msslulu commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

新增Checkstyle Code Quality 工作流,集成pmd静态文件增量扫描和spotbugs增量扫描
checksyle规则集覆盖以下维度:

  • 导入规范(Imports)

  • Javadoc 注释(Javadoc)

  • 代码格式(Formatting)

  • 代码结构(Structure)

  • 命名规范(Naming)

  • 可见性控制(Visibility)

  • 复杂度与规模限制(Complexity & Size)

PMD 通过解析源代码的抽象语法树(AST)来应用规则。
规则主要分为以下几大类:

  • Best Practices (最佳实践):强制推行业界公认的最佳编码实践。

  • Code Style (代码风格):强制执行特定的编码风格规范。

  • Design (设计):检查代码的设计和架构问题,如类过于复杂、耦合过高等。

  • Error Prone (容易出错):检测容易引发错误的代码结构,如空的 try/catch 块。

  • Performance (性能):识别可能影响性能的代码,如低效的字符串拼接。

  • Security (安全):基础的代码安全风险检测

spotbugs主要检测以下内容:

  • Bad practice (不良实践):虽不立刻出错,但长期看是隐患的编码方式,如错误实现 hashCode/equals。

  • Correctness (正确性):可能导致运行时错误的逻辑问题。

  • Malicious code vulnerability (恶意代码漏洞):可能被攻击者利用的代码。

  • Multithreaded correctness (多线程正确性):检查多线程代码中的竞态条件、死锁等问题。

  • Performance (性能):识别效率低下的代码。

  • Security (安全性):高亮代码中的安全漏洞。单独使用 SpotBugs 已能发现部分漏洞,而配合 Find Security Bugs 插件后,检测能力会大幅增强,可检测包括 SQL注入、XSS、路径遍历、XXE、弱加密算法 在内的更多漏洞。

image

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.

Loading
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.

3 participants