SonarQube
  1. SonarQube
  2. SONAR-852

Pmd takes only one exclusion from Sonar

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.10
    • Component/s: Duplications
    • Labels:
      None
    • Number of attachments :
      1

      Description

      Sonar send to the PMD plugin only the first exclusion filter but Sonar filters all when updating the DB.
      This leads to a difference between the plugins reports (via Hudson Violations or the Maven site) and Sonar.

        Issue Links

          Activity

          Freddy Mallet made changes -
          Field Original Value New Value
          Assignee Freddy Mallet [ freddy.mallet ]
          Hide
          Anthonin Bonnefoy added a comment -

          I'm going to submit a patch for this issue after some tests

          Show
          Anthonin Bonnefoy added a comment - I'm going to submit a patch for this issue after some tests
          Hide
          Freddy Mallet added a comment -

          You're right, the problem is located in the PmdMavenPluginHandler class :

            private void configureExclusions(MavenPlugin plugin) {
              if (exclusions!=null) {
                for (String pattern : exclusions.getWildcardPatterns()) {
                  plugin.getConfiguration().setParameter("excludes/exclude", pattern);
                }
              }
            }
          

          I guess we should call plugin.getConfiguration().addParameter(...) instead of plugin.getConfiguration().setParameter(...)

          Show
          Freddy Mallet added a comment - You're right, the problem is located in the PmdMavenPluginHandler class : private void configureExclusions(MavenPlugin plugin) { if (exclusions!= null ) { for ( String pattern : exclusions.getWildcardPatterns()) { plugin.getConfiguration().setParameter( "excludes/exclude" , pattern); } } } I guess we should call plugin.getConfiguration().addParameter(...) instead of plugin.getConfiguration().setParameter(...)
          Freddy Mallet made changes -
          Fix Version/s 1.10 [ 15233 ]
          Hide
          Freddy Mallet added a comment -

          The CheckstyleMavenPluginHandler class must be updated as well.

          Show
          Freddy Mallet added a comment - The CheckstyleMavenPluginHandler class must be updated as well.
          Hide
          Anthonin Bonnefoy added a comment -

          Just replacing setParameter to addParameter seems to do the trick.
          I made a unit test for this case.

          Show
          Anthonin Bonnefoy added a comment - Just replacing setParameter to addParameter seems to do the trick. I made a unit test for this case.
          Anthonin Bonnefoy made changes -
          Attachment pmdExclusion.patch [ 42072 ]
          Freddy Mallet made changes -
          Link This issue is related to SONAR-853 [ SONAR-853 ]
          Freddy Mallet made changes -
          Link This issue is related to SONAR-854 [ SONAR-854 ]
          Freddy Mallet made changes -
          Assignee Freddy Mallet [ freddy.mallet ] Cédric Munger [ cedric.munger ]
          CÚdric Munger made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          Hide
          CÚdric Munger added a comment -

          Thanks for this quality patch Anthonin !

          Show
          CÚdric Munger added a comment - Thanks for this quality patch Anthonin !
          CÚdric Munger made changes -
          Resolution Fixed [ 1 ]
          Status In Progress [ 3 ] Resolved [ 5 ]
          Simon Brandhof made changes -
          Fix Version/s 1.10 [ 15567 ]
          Fix Version/s 1.10RC1 [ 15233 ]
          Olivier Gaudin made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Freddy Mallet made changes -
          Component/s Duplications [ 13913 ]
          Component/s Copy&Paste [ 13876 ]

            People

            • Assignee:
              CÚdric Munger
              Reporter:
              Anthonin Bonnefoy
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: