sonar-gerrit-plugin icon indicating copy to clipboard operation
sonar-gerrit-plugin copied to clipboard

Fixed issues are falsely reported with SonarQube 10.4

Open SR4ven opened this issue 10 months ago • 1 comments

Jenkins and plugins versions report

Environment
Jenkinss Version: 2.440.2
Sonar Gerrit Version: 385.v890738eeff15
SonarQube 10.4.1 Enterprise

What Operating System are you using (both controller, and any agents involved in the problem)?

Windows on controller and Linux agent

Reproduction steps

  1. Make changes to code with SonarQube issues. The issues will be reported and commented by the plugin in Gerrit.
  2. Fix the issue. The issue will be marked as "Closed (Removed)" in the new SonarQube PR view.
  3. The issue will still be commented in the patchset by the sonar-gerrit plugin.

Expected Results

No more report/comment in the patchset for the fixed issue.

Actual Results

Closed issue is still being falsely reported and commented.

Anything else?

Calling api/issues/search?componentKeys=test-project&pullRequest=1234 returns something like this:

{
  "total": 8,
  "p": 1,
  "ps": 100,
  "paging": {
    "pageIndex": 1,
    "pageSize": 100,
    "total": 8
  },
  "effortTotal": 30,
  "issues": [
    {
      "key": "3cdd3192-fbaa-404f-9248-f003d42c3b56",
      "rule": "cpp:S5359",
      "severity": "MAJOR",
      "component": "test-project:src/TestFile.cpp",
      "project": "test-project",
      "hash": "1061db2910c7b4f3ea27e7902c6c52ff",
      "textRange": {
        "startLine": 105,
        "endLine": 105,
        "startOffset": 8,
        "endOffset": 29
      },
      "flows": [
        {
          "locations": [
            {
              "component": "test-project:src/TestFile.cpp",
              "textRange": {
                "startLine": 105,
                "endLine": 105,
                "startOffset": 8,
                "endOffset": 14
              },
              "msg": "Left operand should have type \u0027bool\u0027.",
              "msgFormattings": []
            }
          ]
        },
        {
          "locations": [
            {
              "component": "test-project:src/TestFile.cpp",
              "textRange": {
                "startLine": 105,
                "endLine": 105,
                "startOffset": 18,
                "endOffset": 29
              },
              "msg": "Right operand should have type \u0027bool\u0027.",
              "msgFormattings": []
            }
          ]
        }
      ],
      "resolution": "REMOVED",
      "status": "CLOSED",
      "message": "\"||\" left and right operands should have type \u0027bool\u0027.",
      "effort": "10min",
      "debt": "10min",
      "assignee": "someperson",
      "author": "somemail",
      "tags": [
        "misra-c++2008"
      ],
      "creationDate": "2024-03-28T10:31:23+0000",
      "updateDate": "2024-04-02T16:45:52+0000",
      "closeDate": "2024-04-02T16:45:52+0000",
      "type": "BUG",
      "pullRequest": "84224",
      "scope": "MAIN",
      "quickFixAvailable": false,
      "messageFormattings": [],
      "codeVariants": [],
      "cleanCodeAttribute": "CLEAR",
      "cleanCodeAttributeCategory": "INTENTIONAL",
      "impacts": [
        {
          "softwareQuality": "RELIABILITY",
          "severity": "MEDIUM"
        }
      ],
      "issueStatus": "FIXED"
    },
    ...
  ],
  "facets": []
}

My guess is that the status and issueStatus fields are not checked.

Are you interested in contributing a fix?

No response

SR4ven avatar Apr 15 '24 14:04 SR4ven

@reda-alaoui do you have a clue as to where the missing checks should be implemented? Then maybe I can contribute a fix myself.

SR4ven avatar May 17 '24 10:05 SR4ven