-2

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

4

1 回答 1

0

我得到了答案.....使用链接
创建自定义标准文件后 将此文件放置到 [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

并在 phpmd 的规则选项卡中添加 customPHPMD 规则

于 2018-10-01T04:20:35.963 回答