-
-
Notifications
You must be signed in to change notification settings - Fork 668
Expand file tree
/
Copy pathcustomize-rules.xml
More file actions
33 lines (26 loc) · 1.26 KB
/
customize-rules.xml
File metadata and controls
33 lines (26 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?xml version="1.0"?>
<ruleset name="Custom Ruleset"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
<description>Custom rules for Practice 7</description>
<!-- 1. Lines of Code (LoC) - 通过限制方法长度来实现 -->
<rule ref="category/java/design.xml/ExcessiveMethodLength" />
<!-- 2. Cyclomatic Complexity (CC) - 圈复杂度 -->
<rule ref="category/java/design.xml/CyclomaticComplexity">
<properties>
<property name="methodReportLevel" value="10" />
</properties>
</rule>
<!-- 3. Weighted Methods per Class (WMC) -->
<!-- 在 PMD 中通常包含在 CyclomaticComplexity 的类评估中 -->
<!-- 4. Coupling Between Objects (CBO) - 耦合度 -->
<rule ref="category/java/design.xml/CouplingBetweenObjects">
<properties>
<property name="threshold" value="20" />
</properties>
</rule>
<!-- 5. Lack of Cohesion in Methods (LCOM) - 内聚度 -->
<!-- 注意:PMD 7.0 某些规则名有变动,这里使用通用的设计规则 -->
<rule ref="category/java/design.xml/NcssCount" />
</ruleset>