Uploaded image for project: 'Maven PMD Plugin'
  1. Maven PMD Plugin
  2. MPMD-314

PMD report extension not set correctly for custom report class

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.14.0
    • 3.15.0
    • PMD
    • None

    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

          Activity

            People

              adangel Andreas Dangel
              hedleyproctor Hedley Proctor
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 2h
                  2h
                  Remaining:
                  Remaining Estimate - 2h
                  2h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified