0
votes

I am trying to get the Sonarqube code code coverage and duplication metrics displayed for new PHP code added. I can see the code issues/code smells for the new code added. But there is no count displayed for code duplication (I have even added a few duplicate lines of code, to make sure I have duplicated lines for getting the metrics).

Below is my working environment

  • PHP Symfony Framework: 2.7
  • Sonarqube version: 6.3.1
  • sonar-php-plugin-2.10.0.2087
  • Sonarscanner version: 3.0.1.733-windows
  • Operating System: Windows 7, 64 bit

Steps followed

  1. Execute PHP test cases to generate a xml report (which I will mention in the sonar properties file)
  2. Run Sonarcode analysis with initial code (say "version1") which resulted in some value for Bugs & Vulnerabilities, Code Smells, Coverage (based on the sonar.php.coverage.reportPaths value in sonar properties file) and Code Duplications.
  3. I added new code and PHP unit test cases
  4. Execute PHP unit test cases and added the xml report in sonar properties file with the result xml for version1 (comma separated)
  5. Updated the version of the project (say "version2") in the sonar properties file Rerun the Sonar code analysis
  6. I see a new column added in the report "Leak Period: since version1". This column shows New bugs & vulnerabilities, new code smells (indicating the issues in the newly added code). But it does not display data for Coverage and Duplications

I did not see much of documentation on how to get the reports for new code additions. Any help on this is very much appreciated.

Thank you

1

1 Answers

0
votes

Duplications detection happens automatically unless you turn it off. It is likely that the duplicated blocks you're adding are too small to be detected.