Contents > 4 The SDMetrics User Interface > 4.7 The View 'Rule Checker' > 4.7.2 Accepting Design Rule Violations

4.7.2 Accepting Design Rule Violations

Rules are there to be bent once in a while. That is, sometimes there is a justification why a particular model element should be allowed to violate a particular rule. Such approved rule violations should not be reported anymore for the model element. With the SDMetrics rule checking, you can achieve this by tagging or commenting the model element within your UML design tool as follows.

UML 1.x

To allow a model element e to violate a rule named rulename, define a tagged value for e, where the tag name is violates_rulename (please refer to the manual of your UML modeling tool for details on how to add tagged values). The value of the tagged value pair is ignored by SDMetrics. You can use the value for instance to document the reason why the model element is allowed to violate the rule.

For example, if after a design review a particular class is allowed to violate rules named "GodClass" and "MultipleInheritance", you add two tagged values to the class, one with tag violates_GodClass and the other with the tag violates_MultipleInheritance. From then on, violations of these two rules will no longer be reported for that class.

UML 2

UML 2 no longer has tagged values as they are known in UML 1.x, but every model element can own comments. To exempt a model element from one or more rules, add one or more comments where the body text contains the string violates_rulename for each rule the model element is allowed to violate. Please refer to the manual of your UML modeling tool for details on how to add comments. An example comment body text could be:
"violates_GodClass, violates_MultipleInheritance: confirmed in review"

The comment's body can contain additional text before, after, or between the violates_rulename tags. You can use this to document the reason why the model element is allowed to violate the rule.