phpmd/phpmd

Readme show a xml report as an example for a ruleset

Open

#530 创建于 2017年10月24日

在 GitHub 查看
 (5 评论) (0 反应) (0 负责人)PHP (2,137 star) (343 fork)batch import
DocumentationGood first issue

描述

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 ?

贡献者指南