Description
The Spaghetti Code is an antipattern that is characteristic of procedural thinking in object-oriented
programming. Spaghetti Code is revealed by classes with no structure, declaring long methods with
no parameters, and utilising class or global variables. Names of classes and methods may suggest
procedural programming. Spaghetti Code does not exploit and prevents the use of object-orientation
mechanisms, polymorphism and inheritance.
Detection Rules
RULE_CARD : SpaghettiCode {
RULE : SpaghettiCode {INTER NoInheritanceClassGlobalVariable LongMethodMethodNoParameter };
RULE : LongMethodMethodNoParameter {INTER LongMethod MethodNoParameter };
RULE : LongMethod { (METRIC: METHOD_LOC, VERY_HIGH, 0) };
RULE : MethodNoParameter {(STRUCT: METHOD_NO_PARAM) };
RULE : NoInheritanceClassGlobalVariable {INTER NoInheritance ClassGlobalVariable };
RULE : NoInheritance {(METRIC: DIT, INF_EQ, 2, 0) };
RULE : ClassGlobalVariable {(STRUCT: GLOBAL_VARIABLE, 1) };
};