phpmd/phpmd

Readme show a xml report as an example for a ruleset

Open

#530 opened on Oct 24, 2017

View on GitHub
 (5 comments) (0 reactions) (0 assignees)PHP (2,137 stars) (343 forks)batch import
DocumentationGood first issue

Description

From the read the following example is available as a ruleset:

<?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"
               priority="3">
      This class has too many methods, consider refactoring it.
    </violation>
  </file>
</pmd>

It seems it is a phpmd report file ran at 2009-12-19T22:17:18+01:00 with a single violation. As I use below example for my ruleset (which is PMD compatible):

<?xml version="1.0" ?>
<ruleset name="My 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>Check the code base for mess</description>

  <rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>

  <exclude-pattern>*/*.config.php</exclude-pattern>
  <exclude-pattern>module/SomeDisabledModule</exclude-pattern>
</ruleset>

Or am I mistaken ?

Contributor guide