jenkinsci / sonar-gerrit-plugin

Jenkins plugin for posting SonarQube issues as Gerrit review comments
https://plugins.jenkins.io/sonar-gerrit/
MIT License
27 stars 38 forks source link

Fixed issues are falsely reported with SonarQube 10.4 #155

Open SR4ven opened 7 months ago

SR4ven commented 7 months ago

Jenkins and plugins versions report

Environment ```text 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 commented 5 months ago

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