Chapter 15. Defining Quality Gates

Starting with version 10.3 Sonargraph provides the option to define quality gates (commercial license required). A "quality gate" consists of a set of conditions. If one or more conditions are not met, this is flagged by a "Quality Gate Condition Failed" issue. Conditions define the expectations for the current system's state as well as for an expected quality trend w.r.t a defined baseline. Some sample conditions:

  • "Less than 10 error issues without resolution."

  • "No threshold violations for metric 'Core:SourceFile:TotalLines'."

  • "No additional error issues."

  • "Number of architecture violations must be reduced by at least 10%."

  • "An increase in the Average Component Dependency (ACD) must be lower than 5%."

Sonargraph allows the definition of any number of quality gates and validates those that are "activated", similar to architectures and scripts. Activated quality gates are validated by the "Quality Gate" analyzer. A quality gate consists of two sections, the section for conditions based on the current system state and the section for conditions based on the system diff with respect to a baseline (see Chapter 14, Examining Changes). The Quality Gate view shows the conditions at the top and the table in the lower half lists the matched issues / elements for the selected condition.

Quality Gate View
Figure 15.1. Quality Gate View


TIP

An unlimited number quality gates is supported, so there is no reason to put too many conditions into a single quality gate.

NOTE

Conditions for the current system's state can only be defined on issues. If you want to set a condition for a certain metric value, define a threshold for that metric and then check on the existence of threshold violations.