You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Andreas Dangel (Jira)" <ji...@apache.org> on 2021/01/08 09:47:01 UTC

[jira] [Commented] (MPMD-314) PMD report extension not set correctly for custom report class

    [ https://issues.apache.org/jira/browse/MPMD-314?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17261175#comment-17261175 ] 

Andreas Dangel commented on MPMD-314:
-------------------------------------

Fixed with [https://gitbox.apache.org/repos/asf?p=maven-pmd-plugin.git;a=commit;h=5ad9c5322989411340e3533a7dde2d07b9c58c2e] and
[https://gitbox.apache.org/repos/asf?p=maven-pmd-plugin.git;a=commit;h=fb00aa5fa05c5e204218fdddb193d06cf612381a]

 

> PMD 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
>             Fix For: 3.15.0
>
>   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)