您能告诉我如何在netbeans 8.1中设置自定义phpmd规则集文件吗?

时间:2018-09-28 04:30:38

标签: netbeans-8 phpmd

我正在将phpmd安装到netbeans中,这也会给我带来错误,但是如果我想在netbeans 8.1中设置自定义规则集文件怎么办?

1 个答案:

答案 0 :(得分:0)

我知道了.....
使用link创建自定义标准文件后,
将此文件放置到[main] [usr / share / data / PHPMD / resources / rulesets]
我用[bold] [customPHPMD.xml]制作文件自定义标准规则文件名

为此,我在终端上写了一些命令

cd usr/share/data/PHPMD/resources/rulesets
sudo nano customPHPMD.xml
sudo chmod 777 cusomtPHPMD.xml

<?xml version="1.0"?>
<ruleset name="My first PHPMD 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>
        My custom rule set that checks my code...
    </description>

    <!-- Import the entire unused code rule set -->
    <rule ref="rulesets/codesize.xml/CyclomaticComplexity" />
    <rule ref="rulesets/codesize.xml/NPathComplexity" />
    <rule ref="rulesets/codesize.xml/ExcessiveMethodLength" />
    <rule ref="rulesets/codesize.xml/ExcessiveClassLength" />
    <rule ref="rulesets/codesize.xml/ExcessiveParameterList" />
    <rule ref="rulesets/codesize.xml/TooManyFields" />  
    <rule ref="rulesets/codesize.xml/TooManyMethods" /> 
    <rule ref="rulesets/codesize.xml/ExcessiveClassComplexity" />   
    <rule ref="rulesets/controversial.xml/CamelCaseClassName" />
    <rule ref="rulesets/controversial.xml/CamelCasePropertyName" /> 
    <rule ref="rulesets/controversial.xml/CamelCaseMethodName" />           
    <rule ref="rulesets/controversial.xml/CamelCaseParameterName" />    
    <rule ref="rulesets/controversial.xml/ExitExpression" />    
    <rule ref="rulesets/design.xml/ExitExpression" />   
</ruleset>

此项目右键单击项目->属性-> phpcsmd

and add customPHPMD rule inside rule tab of phpmd