SonarQube PHP
  1. SonarQube PHP
  2. SONARPHP-77

Duplicate measure when project has two files that differ only by suffix

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 0.2
    • Fix Version/s: 0.3
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      In my project I have two files in the same folder:
      vsct_previews.module
      vsct_previews.inc

      The two suffixes (module, inc) are considered as PHP suffix so the two files are analysed but it seems the plugin is using the filename (without suffix) as identifier for measure (see filename=vsct_previews in the error stack) and it produces the following error:

      ...
      [INFO]  pdepend ended with returned code '0'.
      [INFO]  Collecting measures...
      [WARN]  The following file doesn't belong to current project sources or tests : 
      [ERROR]  Report file is invalid or can't be found, plugin will stop.
      java.lang.IllegalArgumentException: This measure has already been saved: org.sonar.api.measures.Measure@19fca0c[id=<null>,metric=org.sonar.api.measures.Metric@189ff97[key=class_complexity_distribution,name=Classes distribution /complexity,type=DISTRIB,enabled=true,qualitative=true,direction=0,domain=Complexity,worstValue=<null>,bestValue=<null>,optimizedBestValue=<null>,hidden=false],value=<null>,data=0=0;5=0;10=0;20=0;30=0;60=0;90=0,description=<null>,alertStatus=<null>,alertText=<null>,tendency=<null>,diff1=<null>,diff2=<null>,diff3=<null>],resource: PhpFile[filename=vsct_previews,longName=vsct_previews.vsct_previews,packageKey=vsct_previews,parent=<null>,unitTest=false]
      	at org.sonar.batch.indexer.DefaultSonarIndex.addMeasure(DefaultSonarIndex.java:266) [sonar-batch-2.1.2.jar:na]
      	at org.sonar.batch.indexer.DefaultSonarIndex.saveMeasure(DefaultSonarIndex.java:257) [sonar-batch-2.1.2.jar:na]
      	at org.sonar.batch.DefaultSensorContext.saveMeasure(DefaultSensorContext.java:94) [sonar-batch-2.1.2.jar:na]
      ...
      

      So I think you should take the whole filename (including suffix) as identifier for a measure.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Frédéric Leroy
            Reporter:
            Anonymous
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: