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

Issues are not closed in some block move conditions

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.6
    • Component/s: Issues
    • Labels:

      Description

      In the following flow some issues are kept open instead of being closed:

      1. first analysis detects four issues on the same rule, for instance because the diamond operator <> is not used:

      private final Deque<String> one = new ArrayDeque<String>();
      private final Deque<String> two = new ArrayDeque<String>();
      private final Deque<String> three = new ArrayDeque<String>();
      private final Deque<String> four = new ArrayDeque<String>();
      

      2. edit code to fix the 3 last issues and keep the first one open. The issues must move to different lines, for example by inserting a comment at the beginning.

      // add a line so that the open issue on "one" is not on the same line number.
      private final Deque<String> one = new ArrayDeque<String>();
      private final Deque<String> two = new ArrayDeque<>();
      private final Deque<String> three = new ArrayDeque<>();
      private final Deque<String> four = new ArrayDeque<>();
      

      3. trigger a new analysis. The 3 issues which are supposed to be fixed remain open and are not closed. The first issue is correctly matched with the existing one.

      Explanation

      The first step of issue tracking algorithm compares issues that are on the same line number and same line body. Here as lines moved, no issues match.
      The second step detects moves of code blocks. When processing the first issue, we search for all the issues that are located in similar code blocks. Here the 4 issues loaded from database successfully match. Obviously only one can be flagged as matched. The bug is that the remaining issues are lost in space instead of being flagged as closed.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              simon.brandhof Simon Brandhof (Inactive)
              Reporter:
              simon.brandhof Simon Brandhof (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: