fix:code check plugin(Checkstyle +PMD+SpotBugs) - #324
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
新增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、弱加密算法 在内的更多漏洞。
PR
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
Background and solution
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information
Summary by CodeRabbit
Quality Improvements
CI Improvements