PHPMD不工作规则ShortVariable并忽略TooManyFields

时间:2017-06-23 12:24:53

标签: phpstorm phpmd

任何人都可以告诉我为什么在PHPSTORM 2017.1和PHPMD 2.6.0下一些配置选项不起作用:

  • ShortVariable

PhpStorm标记变量

private $id;

as“Configured minimum length is 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>

0 个答案:

没有答案