[ 
https://issues.apache.org/jira/browse/MPMD-314?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andreas Dangel reassigned MPMD-314:
-----------------------------------

    Assignee: Andreas Dangel

> 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
>            Assignee: Andreas Dangel
>            Priority: Minor
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> 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)

Reply via email to