Ensures a value of so called LCOM4 to be less than 2 in a class.
This rule aims to keep methods in a class high cohesive by using LCOM4 metric. It suggests that the class needs to be split into two or more classes if LCOM4 > 1.
Examples of incorrect code for this rule:
// LCOM4 = 1
class A {
foo() {
return this.var1
}
bar() {
return this.var1
}
}
Examples of correct code for this rule:
// LCOM4 = 2
class A {
foo() {
return this.var1
}
bar() {
return this.var2
}
}