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

          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(...)
          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.
          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 !

            People

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

              Dates

              • Created:
                Updated:
                Resolved: