Skip to content

Commit 9a52b07

Browse files
hms5232shaunthegeek
authored andcommitted
fix: phpmd prevent migration from being committed
因為預設的 ShortMethodName 規則要求至少 3 個字長 導致 migration 提交因其 up() 被阻擋 所以需要另外拉出來寫規則指定例外
1 parent 03eba5e commit 9a52b07

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/stubs/phpmd.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
<rule ref="rulesets/naming.xml">
1212
<exclude name="ShortVariable" />
13+
<exclude name="ShortMethodName" />
1314
</rule>
1415

1516
<rule ref="rulesets/naming.xml/ShortVariable"
@@ -24,5 +25,17 @@
2425
</properties>
2526
</rule>
2627

28+
<rule ref="rulesets/naming.xml/ShortMethodName"
29+
since="0.2"
30+
message="Avoid method or function with short names like {0}. Configured minimum length is {1}."
31+
class="PHPMD\Rule\Naming\ShortMethodName"
32+
externalInfoUrl="https://phpmd.org/rules/naming.html#shortmethodname">
33+
<priority>3</priority>
34+
<properties>
35+
<property name="minimum" description="Minimum length for a method or function name" value="3"/>
36+
<property name="exceptions" value="up" />
37+
</properties>
38+
</rule>
39+
2740
<rule ref="rulesets/unusedcode.xml" />
2841
</pmd>

0 commit comments

Comments
 (0)