Predicate lackOfCohesionCK
The Chidamber-Kemerer lack of cohesion metric.
The aim of this metric is to try and determine whether a class represents one abstraction (good) or multiple abstractions (bad). If a class represents multiple abstractions, it should be split up into multiple classes.
In the Chidamber and Kemerer method, this is measured as follows:
n1= number of pairs of distinct methods in a type that do not have at least one commonly accessed field or property.n2= number of pairs of distinct methods in a type that do have at least one commonly accessed field or property.lcom=max((n1 - n2)/2, 0).
We divide by 2 because each pair (m1, m2) is counted twice in
n1 and n2.
High values of lcom indicate a lack of cohesion. Specifically,
an lcom of greater than 500 indicates a potential problem.
Import path
import semmle.code.csharp.metrics.Couplingpredicate lackOfCohesionCK(ValueOrRefType t, float locm)