Skip to content

Commit

Permalink
Merge pull request #834 from martzd/feature/add-tool-to-xml-report
Browse files Browse the repository at this point in the history
Add "tool" property to main "pmd" tag in XML report
  • Loading branch information
tvbeek committed Oct 18, 2020
2 parents a429154 + a5203dc commit 98491e8
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/main/php/PHPMD/Renderer/XMLRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public function renderReport(Report $report)
{
$writer = $this->getWriter();
$writer->write('<pmd version="' . PHPMD::VERSION . '" ');
$writer->write('tool="phpmd" ');
$writer->write('timestamp="' . date('c') . '">');
$writer->write(PHP_EOL);

Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/files/pmd/default-xml.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<pmd version="@package_version@" timestamp="">
<pmd version="@package_version@" tool="phpmd" timestamp="">
<file name="#{rootDirectory}_DS_source_DS_ccn_function.php">
<violation beginline="21" endline="52" rule="CyclomaticComplexity" ruleset="Code Size Rules" package="+global" externalInfoUrl="https://phpmd.org/rules/codesize.html#cyclomaticcomplexity" function="ccn_function" priority="3">
The function ccn_function() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/files/pmd/single-directory.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<pmd version="@package_version@" timestamp="">
<pmd version="@package_version@" tool="phpmd" timestamp="">
<file name="#{rootDirectory}_DS_source_DS_ccn_function.php">
<violation beginline="21" endline="52" rule="CyclomaticComplexity" ruleset="Code Size Rules" package="+global" externalInfoUrl="https://phpmd.org/rules/codesize.html#cyclomaticcomplexity" function="ccn_function" priority="3">
The function ccn_function() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/files/pmd/single-file.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<pmd version="@package_version@" timestamp="">
<pmd version="@package_version@" tool="phpmd" timestamp="">
<file name="#{rootDirectory}_DS_source_DS_ccn_function.php">
<violation beginline="21" endline="52" rule="CyclomaticComplexity" ruleset="Code Size Rules" package="+global" externalInfoUrl="https://phpmd.org/rules/codesize.html#cyclomaticcomplexity" function="ccn_function" priority="3">
The function ccn_function() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<pmd version="@package_version@" timestamp="">
<pmd version="@package_version@" tool="phpmd" timestamp="">
<file name="/bar.php">
<violation beginline="23" endline="42" rule="RuleStub" ruleset="TestRuleSet" package="TestStubPackage" externalInfoUrl="https://phpmd.org/rules/index.html" priority="5">
Test description
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<pmd version="@package_version@" timestamp="">
<pmd version="@package_version@" tool="phpmd" timestamp="">
<error filename="/tmp/foo.php" msg="Failed for file &quot;/tmp/foo.php&quot;." />
<error filename="/tmp/bar.php" msg="Failed for file &quot;/tmp/bar.php&quot;." />
<error filename="/tmp/baz.php" msg="Failed for file &quot;/tmp/baz.php&quot;." />
Expand Down

0 comments on commit 98491e8

Please sign in to comment.