CAST Engineering Dashboard - Violations - No Violation - Avoid classes of high lack of Cohesion QR

Purpose

Some violations are missing for this QR.

Applicable in CAST Version

ReleaseYes/No
8.3.x

Applicable RDBMS

RDBMSYes/No
CSS

Action Plan

Class A  in file xyz.cs violating the rule Avoid classes of high lack of Cohesion

If you have only constants fields in your class: m=0, a=0, m(Aj)= 0 for all attributes.

a= 0 as contant fields are not considered in the count of class data member.

Here are the results, when applying the computation on the provided Class A: m=0, a=0, m(Aj)= 0 for all attributes Hence: LCOM = [1/0 x 0 - 0 ] / [1] => division by 0 => LCOM set to 1. Hence the class is listed as violating the rule.

Since the class is only containing static fields, a simple remidiation is to

  1. Replace the class by an enum

Notes/comments

Refer to LCOM calculation

Related Pages

CAST Engineering Dashboard - Violations - False violation or no violation