Phpstorm PHPMD不工作规则ShortVariable和ignore TooManyFields
有人能告诉我为什么在PHPSTORM 2017.1和PHPMD 2.6.0下某些配置选项不起作用:Phpstorm PHPMD不工作规则ShortVariable和ignore TooManyFields,phpstorm,phpmd,Phpstorm,Phpmd,有人能告诉我为什么在PHPSTORM 2017.1和PHPMD 2.6.0下某些配置选项不起作用: 短变量 PhpStorm标记变量 private $id; “配置的最小长度为3” 忽略字段TooManyFields pSpRosik显示:“X类有21个字段。考虑x的增长,以保持字段数在15以下”。 我搜索了很多文章,但没有人为我工作 <?xml version="1.0"?> <ruleset name="MyProject Mess Detector rule
- 短变量
private $id;
“配置的最小长度为3”
- 忽略字段TooManyFields
<?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>
MyProjectMess探测器
1.
3.
您是否将自定义规则集添加到PHP | PHP Mess Detector验证检查设置中?当从命令行运行PHPMD时,您能看到这些规则起作用吗?谢谢Vlad的回答。我已将我的规则集添加到PHPStorm中的检查设置中(设置reportLevel工作正常),但其他设置不起作用。我将尝试从命令行运行此命令,并让您知道。正如我之前所说的-看起来有些选项有效,有些则无效。如果问题仍然存在,请随时通过PhpStorm>Help>New Support Request与我们联系。