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

Make it clear why a file with no blocks is not part of the CPD analysis

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.4
    • Component/s: Duplications, Scanner
    • Labels:
      None

      Description

      There is a threshold (10 by default) on the minimal number of lines a block should contains to be added to the index. Some very repetitive files may have more than 10 lines, but because similar lines are "merged", in the end the file will have no blocks.
      In logs, it look like:

      17:19:26.947 INFO: Index files
      17:19:26.963 DEBUG: Language of file 'src/Duplication_2.php' is detected to be 'php'
      17:19:26.963 DEBUG: Language of file 'src/Duplication_2_2.php' is detected to be 'php'
      17:19:26.964 DEBUG: Language of file 'src/Duplication_2_2_1.php' is detected to be 'php'
      17:19:26.972 DEBUG: Language of file 'src/Duplication_2_2_2.php' is detected to be 'php'
      17:19:26.972 DEBUG: Language of file 'src/test.php' is detected to be 'php'
      17:19:26.976 DEBUG: Language of file 'src/test copy.php' is detected to be 'php'
      17:19:26.980 INFO: 6 files indexed
      [...]
      17:19:28.104 INFO: Sensor CPD Block Indexer
      17:19:28.105 INFO: DefaultCpdBlockIndexer is used for php
      17:19:28.105 DEBUG: No CpdMapping for language php
      17:19:28.105 INFO: Sensor CPD Block Indexer (done) | time=1ms
      17:19:28.111 INFO: Calculating CPD for 4 files
      17:19:28.113 DEBUG: Detection of duplications for cpd_project:src/test copy.php
      17:19:28.130 DEBUG: Detection of duplications for cpd_project:src/Duplication_2.php
      17:19:28.131 DEBUG: Detection of duplications for cpd_project:src/test.php
      17:19:28.135 DEBUG: Detection of duplications for cpd_project:src/Duplication_2_2.php
      17:19:28.136 INFO: CPD calculation finished
      

      There is no informations (even in debug) about why there are only 4 files processed by CPD (while 6 files were indexed).

      We should log something in DEBUG like: "Not enough content in 'xxxx' to have a CPD block, it will not be part of the duplication detection."

        Attachments

          Activity

            People

            • Assignee:
              duarte.meneses Duarte Meneses
              Reporter:
              julien.henry Julien Henry
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved: