You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Hedley Proctor (Jira)" <ji...@apache.org> on 2021/01/04 23:41:00 UTC
[jira] [Created] (MPMD-314) Report extension not set correctly for
custom report class
Hedley Proctor created MPMD-314:
-----------------------------------
Summary: Report extension not set correctly for custom report class
Key: MPMD-314
URL: https://issues.apache.org/jira/browse/MPMD-314
Project: Maven PMD Plugin
Issue Type: Bug
Components: PMD
Affects Versions: 3.14.0
Reporter: Hedley Proctor
As per the code, and PMD docs, you can specify a custom report (renderer) class, like this:
<configuration>
<includeTests>true</includeTests>
<rulesets>
<ruleset>pmd-ruleset.xml</ruleset>
</rulesets>
<format>net.sourceforge.pmd.renderers.SummaryHTMLRenderer</format>
</configuration>
The code correctly instantiates the report class and runs it, as per the code in the PmdExecutor createRenderer method, line 443. The problem is that the extension is hard code to match the "format", as for the built in formats this is "html", "csv" etc. So in this case, you get a file called:
pmd.net.sourceforge.pmd.renderers.SummaryHTMLRenderer
I believe the correct fix is a one line change to line 432, from:
writeReport( report, renderer, format );
to:
writeReport( report, renderer, renderer.defaultFileExtension() );
This should function the same for the built in formats, and allow other Java classes to specify their own extension. I have cloned the repo and tested this on my local to confirm it functions correctly. I will attempt to create a pull request.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)