php - PHPMD - include a whole ruleset and configure the properties -


i using phpmd (http://phpmd.org/) , quite new this. md works, writing ruleset configure metrics should used. instead of including each rule individually, load whole rulesets. have problem don't know how configure properties of single rules if include whole set.

for example, want use rule check cyclomatic complexity. can use

<?xml version="1.0"?> <ruleset name="demo 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> custom ruleset checks code </description>      <rule ref="rulesets/codesize.xml/cyclomaticcomplexity">         <properties>             <property name="reportlevel" value="11" />         </properties>     </rule> </ruleset> 

but if want use rules ruleset, can write

<?xml version="1.0"?> <ruleset name="demo 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> custom ruleset checks code </description>      <rule ref="rulesets/codesize.xml" /> </ruleset> 

now how can use configuration of property (in case reportlevel cyclomatic complexity) when include whole ruleset? tried

[...]     <rule ref="rulesets/codesize.xml">         <properties>             <property name="cyclomaticcomplexity.reportlevel" value="11" />         </properties>     </rule> [...] 

but didn't work. searched in documentation never found example anywhere.

the way have found achieve using exclude element, including rules ruleset except 1 want customize, , including separately.

<?xml version="1.0"?> <ruleset name="demo 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> custom ruleset checks code </description>     <rule ref="rulesets/codesize.xml">         <exclude name="cyclomaticcomplexity"/>     </rule>      <rule ref="rulesets/codesize.xml/cyclomaticcomplexity">         <properties>             <property name="reportlevel" value="11" />         </properties>     </rule> </ruleset> 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -