Skip to content

Commit

Permalink
fix: phpmd prevent migration from being committed
Browse files Browse the repository at this point in the history
因為預設的 ShortMethodName 規則要求至少 3 個字長
導致 migration 提交因其 up() 被阻擋
所以需要另外拉出來寫規則指定例外
  • Loading branch information
hms5232 authored and shaunthegeek committed Nov 16, 2021
1 parent 03eba5e commit 9a52b07
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/stubs/phpmd.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

<rule ref="rulesets/naming.xml">
<exclude name="ShortVariable" />
<exclude name="ShortMethodName" />
</rule>

<rule ref="rulesets/naming.xml/ShortVariable"
Expand All @@ -24,5 +25,17 @@
</properties>
</rule>

<rule ref="rulesets/naming.xml/ShortMethodName"
since="0.2"
message="Avoid method or function with short names like {0}. Configured minimum length is {1}."
class="PHPMD\Rule\Naming\ShortMethodName"
externalInfoUrl="https://phpmd.org/rules/naming.html#shortmethodname">
<priority>3</priority>
<properties>
<property name="minimum" description="Minimum length for a method or function name" value="3"/>
<property name="exceptions" value="up" />
</properties>
</rule>

<rule ref="rulesets/unusedcode.xml" />
</pmd>

0 comments on commit 9a52b07

Please sign in to comment.