谁能告诉我为什么在 PHPSTORM 2017.1 和 PHPMD 2.6.0 下某些配置选项不起作用:
- 短变量
PhpStorm 标记变量
private $id;
作为“配置的最小长度为 3”
- 忽略字段 TooManyFields
PhpStorm 显示:“X 类有 21 个字段。考虑提高 X 以保持字段数低于 15”。我搜索并看到了很多文章,但没有一篇适合我。
<?xml version="1.0"?>
<ruleset name="MyProject Mess Detector rule set"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0
http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="
http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>
MyProject Mess Detector
</description>
<rule ref="rulesets/cleancode.xml">
<exclude name="StaticAccess"/>
</rule>
<rule ref="rulesets/codesize.xml/CyclomaticComplexity">
<priority>1</priority>
<properties>
<property name="reportLevel" value="9" />
</properties>
</rule>
<rule ref="rulesets/naming.xml">
<exclude name="ShortVariable"/>
</rule>
<rule ref="rulesets/naming.xml/ShortVariable"
since="0.2"
message="Avoid variables with short names like {0}. Configured minimum length is {1}."
class="PHPMD\Rule\Naming\ShortVariable"
externalInfoUrl="http://phpmd.org/rules/naming.html#shortvariable">
<priority>3</priority>
<properties>
<property name="minimum" value="2" />
<property name="exceptions" value="id" />
</properties>
</rule>
<rule ref="rulesets/codesize.xml">
<exclude name="TooManyFields"/>
</rule>
<rule ref="rulesets/unusedcode.xml" />
</ruleset>