14.1.  Creating Quality Gates

A new quality gate can be created via the main menu "File""New""New Quality Gate..." or by selecting the "Quality Gates" folder in the "Files" view and opening the context menu.

Define Conditions for the Current System's State

A condition for the current system's state can be created via the context menu of the "Current System Conditions" node. If a metric id is specified, only threshold violations for that metric are matched.

Current System Condition Dialog
Figure 14.2. Current System Condition Dialog


To match threshold violations, simply specify a metric id and use the wildcard "any" as issue type.

Define Conditions With Respect to a Baseline

Conditions with respect to a baseline can either be defined based on issues or metric values. The "Baseline Issue Dialog" looks similar to the "Current System Condition" dialog and adds additional input fields for threshold violations.

Baseline Condition Dialog
Figure 14.3. Baseline Issue Condition Dialog


If small changes to existing threshold violations should be tolerated, define an absolute or relative threshold for the metric value difference.

Some issues support a "relaxed" check, meaning that already existing issues that got slightly worse are tolerated. The following table provides the details about the effect of "relaxed" and "strict", an "X" means that the condition will fail for this change, "-" means that the change is tolerated:

Change "Relaxed" "Strict" (default)
Any added issue of severity error or warning. X X
Any issue that changed severity from warning to error. X X
Any issue whose resolution got removed. X X
Cycle group with more involved elements. X X
Cycle group with more parser dependencies to remove. - X
Threshold violation with a worsened metric value, if no diff threshold is defined. - X
Threshold violation with a worsened metric value, if the value diff is below the defined threshold. - X
Duplicate code blocks with more occurrences. X X
Duplicates code blocks with more involved lines. - X
Table 14.1. Effect of "Relaxed" and "Strict"

Define Baseline Metric Conditions

Values for some metrics will grow as more code is added to the system. An example are coupling metrics. It is nevertheless useful to monitor how much a metric value changes, as a big increase is usually an indicator for a bad design decision. Changes in metric values can be monitored via "Baseline Metric Conditions". The dialog allows the configuration of an absolute and/or relative threshold:

Baseline Metric Condition Dialog
Figure 14.4. Baseline Metric Condition Dialog


Only metrics on 'System' level are supported because only those values are currently part of the 'System Diff'.

Define Quality Gate Exclude Filters

For both sections of the quality gate it is possible to define "Exclude Filters". Issues matched by an exclude filter will no longer affect the outcome of any issue condition contained in the same section, i.e. either conditions for the current system's state or baseline conditions.

Exclude Filter Dialog
Figure 14.5. Exclude Filter Dialog


The column "Information" provides details about how many issues a filter matches and how many conditions are affected.