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

Issue tracking is missing random issues moved to other lines

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 7.9.2, 8.0
    • Component/s: Issues
    • Edition:
      Community
    • Production Notes:
      None

      Description

      Why

      Following a ticket opened by a customer to support, a reproducer was shared with the Dev team which allowed to highlight that random issues on a large Cobol file, instead of being detected as moved by SonarQube, were closed and new ones, identical, created.

      (see details in Discuss thread)

      What

      A piece of the code behind the code move heuristic is indexing issues by line in a MultiMap

      Issues are DefaultIssue objects which hashCode method is based solely on DefaultIssue's key field

      The Multimap implementation used in code move is Set based

      Unfortunately, at this point in the report processing, no DefaultIssue instance has a key yet, which implies that all of them have the same "hashcode", which implies that, when stored in the MultiMap for the same line, only one DefaultIssue instance is actually stored (the first added, which is unpredictable)

      The consequence is that when there are multiple issues on the same line, only one of those issues is taken into account by the code move heuristic. Which one is random.

       

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sebastien.lesaint Sebastien Lesaint
                Reporter:
                sebastien.lesaint Sebastien Lesaint
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: