Skip to content
Tutorials Center
My learning

Topics

Lesson 10 of 37 ยท Concepts and Setup

The Issue Lifecycle

Follow a SonarQube issue from creation to closure: statuses, resolutions, false positives and accepted issues, assignment, comments, tracking across scans and bulk changes.

An issue is not a static line in a report. It is a record with a history: it appears in one analysis, may be assigned, discussed, accepted or fixed, and then disappears from the open list in a later analysis. Knowing the lifecycle lets you triage efficiently and keeps your numbers honest. Status names changed over the years; this lesson uses the current vocabulary and mentions older names.

Statuses

In current versions an issue is in one of these statuses:

  • Open: new, nobody has dealt with it. All new issues start here.
  • Accepted: the team has decided to live with the problem for now (the issue is real but not worth fixing). It leaves the quality gate counts. Older versions called this Won't Fix.
  • False positive: the analyzer is wrong; the code is fine. Also leaves the counts.
  • Fixed: the code changed so that the rule no longer fires. SonarQube sets this on its own during the next analysis. (In older versions the equivalent was Resolved then Closed; you may also see Confirmed and Reopened in earlier releases.)

Two actions are human decisions (accept and mark as false positive), while Fixed is automatic. Both require the Administer Issues permission, and both should carry a comment explaining why. A good habit is: never mark something false positive without writing the reason, because the reader in a year will be you.

stateDiagram-v2
  [*] --> Open: new analysis finds it
  Open --> Accepted: team accepts the risk
  Open --> FalsePositive: analyzer is wrong
  Open --> Fixed: code changed, rule no longer fires
  Accepted --> Open: reopen
  FalsePositive --> Open: reopen
  Fixed --> Open: problem returns

Fixed is set by the server; Accepted and False positive are set by people.

Modeling the lifecycle

The stand-in below enforces the allowed moves and records who did what, which is the heart of the issue history you see in the UI.

Python An issue status machine (stand-in)

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Tracking issues across analyses

How does SonarQube know that today's issue on line 40 is yesterday's issue from line 31? It tracks issues using the rule, the file and a hash of the text of the line (and nearby lines), not the line number. Adding a function above does not make old issues "new".

The tracker is why the "new code" idea works: only issues that cannot be matched to an earlier analysis count as new.

Python Match issues even when lines move (stand-in)

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Everyday triage

Open the Issues tab and filter with the left panel: type, severity or impact, status, rule, language, tag, assignee, and Creation date or New code. Common workflows:

  • Daily: filter to New code and your own assigned issues.
  • Release review: filter to Open issues with High severity.
  • Cleanup: group by rule to find the one rule that causes 40% of the smells, then fix or disable it.
  • Bulk change: select many issues, then Bulk Change to assign, add a tag, or change status. Use sparingly, and comment.

Each issue has tabs for Where is the issue?, Why is this an issue?, How can I fix it? and Activity, which shows changes and comments. You can assign it to a user, link to it from a ticket and use @ mentions in comments for notifications.

Do not hide real problems

Marking issues accepted or false positive lowers the numbers, so an unchecked habit hides debt. Keep a team rule: false positives need a comment, accepted issues need an owner or a ticket, and review the Accepted list every quarter. You can also suppress an issue in code with // NOSONAR, which hides all issues on that line from the analysis; use it sparingly, since it has no reason attached.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Who sets the Fixed status?

    Fixed is applied by the server when a later analysis no longer reports the issue.
  2. 2. How are issues followed from one analysis to the next?

    Tracking uses rule, file and code content fingerprints so moved code keeps its issues.
  3. 3. Why should you always write a comment when marking a false positive?

    Without a recorded reason, nobody can tell later whether the decision was sound.
  4. 4. Which permission is needed to change an issue's status?

    Changing statuses and assigning issues requires the Administer Issues project permission.

Summary

  • Statuses: Open, Accepted, False positive and Fixed (older versions used Confirmed, Resolved, Closed, Won't Fix).
  • Fixed is automatic; Accepted and False positive are human decisions that need a comment.
  • Issues are tracked by rule and code fingerprint, which defines what is new.
  • Filter, assign and bulk-change in the Issues tab, and review accepted issues regularly.

Next: Rules and Quality Profiles