Skip to content
Tutorials Center
My learning

Topics

Lesson 12 of 37 ยท Rules and Quality Gates

The Clean Code Taxonomy

Learn the Clean Code taxonomy: software qualities (security, reliability, maintainability), clean code attributes, impact severities, and how legacy issue types map to it.

Recent SonarQube versions describe every issue with a vocabulary called the Clean Code taxonomy. It answers three questions: What part of quality is affected? What kind of code defect is it? and How bad is the impact? This lesson defines each term and shows how the older Bug, Vulnerability and Code Smell types map to it, so you can read both old reports and new dashboards.

The exact attribute list and the default severities can change between releases. Use this lesson for the structure; the rule pages in your installed version are the source of truth for individual rules.

Three software qualities

Every rule affects at least one software quality:

  • Security: the code can be abused by an attacker.
  • Reliability: the code may fail or give wrong results at runtime.
  • Maintainability: the code is costly to understand or change.

One rule may affect several qualities, each with its own impact. A hard-coded secret, for instance, affects security strongly and perhaps maintainability a little.

Impact severity

For each affected quality, the rule has an impact severity: High, Medium or Low (and Info in some contexts). The meaning is the same across qualities: high means a serious consequence is likely, medium means a moderate one, low means a small one. You can read it as: "if this goes unfixed, how much damage can it cause to this quality?"

Impact severities replace the older Blocker, Critical, Major, Minor and Info scale for most uses, although the old severity is still visible on rules and through some API fields for compatibility.

Clean code attributes

The clean code attribute names the kind of defect in the code. There are four families, each with several attributes:

  • Consistent: code that is formatted, conventional, identifiable and unambiguous (for example Conventional, Formatted, Identifiable).
  • Intentional: code that is clear, logical, complete and efficient (examples: Clear, Logical, Complete, Efficient).
  • Adaptable: code that is focused, distinct and modular (so it can change safely) (examples: Focused, Distinct, Modular, Tested).
  • Responsible: code that respects laws and ethics: Lawful, Respectful, Trustworthy.

A bug such as a null dereference is typically Intentional (logical). A function with 80 lines is Adaptable (focused). A secret in code is Responsible (trustworthy).

One issue, three questions

Quality Security, reliability or maintainability?
Attribute What kind of defect is it?
Impact High, medium or low?

Together they replace one blunt label.

1 / 2

Mapping the classic types

The older issue types still appear in the API and can be used as filters. The mapping to the new model is approximately:

  • Bug is an issue with Reliability impact.
  • Vulnerability is an issue with Security impact.
  • Code smell is an issue with Maintainability impact.
  • Security hotspot stays a separate review workflow.

An issue can have more than one impact, so the old single type shows only the primary one. This is why a count by quality can be larger than a count by type.

Python Describe issues with the taxonomy (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.

The rule keys above are sample labels for the demo. The stand-in picks the primary impact as the highest severity, preferring Security on a tie, which mirrors how a legacy type is derived but is a simplification.

Counting by quality

Dashboards count open issues per quality and severity. This second stand-in builds the matrix you see on the Issues page when you group by quality.

Python Issue matrix by quality and severity (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.

Why the change helps

The old types hid information: a "code smell" could be a minor naming issue or a serious design flaw. With attributes you can say show me all Intentional defects with High reliability impact and get a focused list. The attribute also suggests the fix style: Consistent issues are often style and can be automated, while Adaptable ones need a refactoring.

Ratings (A to E) are still computed per quality from the impacts: your Reliability rating, for example, depends on the worst reliability impact among open issues.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which are the three software qualities?

    Security, reliability and maintainability are the software qualities affected by issues.
  2. 2. What does the clean code attribute describe?

    An attribute such as Logical or Focused names the kind of problem; the impact says how bad it is.
  3. 3. Which impact severities exist?

    Impacts are High, Medium and Low (with Info in some contexts); A to E are ratings.
  4. 4. How does a classic Vulnerability map to the new model?

    Vulnerabilities correspond to issues that have a Security impact.

Summary

  • Each rule has software qualities, impact severities and a clean code attribute.
  • Attributes come in four families: Consistent, Intentional, Adaptable, Responsible.
  • Classic types map to qualities: bug to reliability, vulnerability to security, smell to maintainability.
  • An issue can have several impacts; ratings follow the worst impact per quality.

Next: Quality Gates