Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-3733

Include test code when processing duplication metrics

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 3.2
    • Fix Version/s: None
    • Labels:
      None

      Description

      This is an enhancement request triggered by an email sent to user@sonar.codehaus.org titled "No duplications for tests?". Here is the content of that email:

      When I run sonar-runner and review the results I see duplication for files that are only in the source folder, but not in the test folder. I know there are some small duplicate blocks of code in my tests, but they are not listed when I drill in to the duplicates from the Sonar Dashboard. My test files are included in the analysis, and I can confirm this when I search for the class names in the Sonar Dashboard. Here is my configuration for the folders in sonar-project.properties:

      sources=app/src/main/java
      tests=acceptance-tests/src/test/java

      If I change my configuration to make the test folder my source folder, and remove the 'tests' setting, then I see the duplicate code for the tests in the dashboard:

      1. sources=app/src/main/java
        sources=acceptance-tests/src/test/java
      2. tests=acceptance-tests/src/test/java

      It would be useful to use the first configuration and have the duplication results include the test code. This way I do not have to configure a separate sonar-project.properties for the app and acceptance-tests folders, then amalgamate the results.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            sporcina Sheldon Porcina
            Votes:
            12 Vote for this issue
            Watchers:
            9 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: