Skip to content

Commit

Permalink
Correct readme explaining ruleset and report. (#679)
Browse files Browse the repository at this point in the history
  • Loading branch information
DannyvdSluijs authored and kylekatarnls committed Oct 19, 2019
1 parent fdee858 commit da15a36
Showing 1 changed file with 31 additions and 10 deletions.
41 changes: 31 additions & 10 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,42 @@ Command line usage

Type ``phpmd [filename|directory] [report format] [ruleset file]``, i.e: ::

mapi@arwen ~ $ phpmd PHP/Depend/DbusUI/ xml rulesets/codesize.xml

While the ``rulesets/codesize.xml`` ruleset file could look like this::
mapi@arwen ~ $ phpmd php/PDepend/DbusUI/ xml rulesets.xml

While the ``rulesets.xml`` ruleset file could look like this::

<?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>

<rule ref="rulesets/codesize.xml" />
<rule ref="rulesets/cleancode.xml" />
<rule ref="rulesets/controversial.xml" />
<rule ref="rulesets/design.xml" />
<rule ref="rulesets/naming.xml" />
<rule ref="rulesets/unusedcode.xml" />
</ruleset>

The xml report would like like this::

<?xml version="1.0" encoding="UTF-8" ?>
<pmd version="0.0.1" timestamp="2009-12-19T22:17:18+01:00">
<file name="/projects/pdepend/PHP/Depend/DbusUI/ResultPrinter.php">
<violation beginline="67"
endline="224"
rule="TooManyMethods"
ruleset="Code Size Rules"
package="PHP_Depend\DbusUI"
class="PHP_Depend_DbusUI_ResultPrinter"
<violation beginline="81"
endline="81"
rule="UnusedFormalParameter"
ruleset="Unused Code Rules"
externalInfoUrl="https://phpmd.org/rules/unusedcode.html#unusedformalparameter"
priority="3">
This class has too many methods, consider refactoring it.
Avoid unused parameters such as '$builder'.
</violation>
</file>
</pmd>
Expand Down

0 comments on commit da15a36

Please sign in to comment.