Description
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.
Attachments
Issue Links
- relates to
-
MPMD-306 PMD and CPD goal must specify output file name when custom renderer specified as format.
- Open
- links to