Contents > 4 The SDMetrics User Interface > 4.7 The View 'Rule Checker' > 4.7.1 Filtering Design Rules

4.7.1 Filtering Design Rules

Some design rules only apply to certain types of UML models, e.g., models at a particular development phase (e.g., requirements, analysis, design), models of a particular application domain (e.g., embedded systems, real time systems), etc.

The measurement catalog indicates the applicable types of models for each rule. With the design rule filter, you can instruct SDMetrics to only check and report design rules that apply to your model at hand.

Writing Rule Filters

Table 3 shows some example filters and explains their function. For the example, we assume we have four application areas defined:

Example FilterExplanation
design To only check the rules of one application area, simply specify the name of that application area.
The example filter only checks rules that are applicable at the design phase.
design&realtime To check rules applicable to all of several areas, combine the areas with the & operator.
The example filter only checks rules that are applicable to real-time systems at the design phase.
analysis|design To check rules applicable to at least one of several areas, combine the areas with the | operator.
The example filter only checks rules that are applicable at the analysis phase or at the design phase.
!analysis To check rules that do not apply to a particular area, precede the name of the area with the ! operator.
The example filter only checks rules that do not apply to the analysis phase.
'design' Some rules do not explicitly define an application area. Such rules are implied to apply to all areas. Therefore, the filter design will also check rules that do not specify any application area at all.
To instruct SDMetrics to only check rules that explicitly are defined for an application area, put the application area in single quotes.
The example filter only checks design rules which explicitly list "design" among their application areas.
design&
(!'realtime'|pedantic)
Using parentheses, you can define arbitrarily complex rule filters. The example filter checks all rules applicable to the design phase that are also not explicitly defined for real-time systems or are pedantic.
Table 3: Rule filter examples.

Applying Rule Filters

To apply a filter, specify it in the "filter" text field at the top of the rule checker view, and press return or click the "Apply" button. To clear the filter, and show all design rule violations regardless of their application area, click the "Clear" button.

If your filter contains a syntax error (illegal operation, unmatched parentheses etc.) you will get an error message and the rules will not be checked. If your filter specifies an application area that is not defined explicitly by at least one rule, SDMetrics will warn you about this, but will check the rules anyway.