-
Notifications
You must be signed in to change notification settings - Fork 3
Module Smell Detector
The Smell Detector module is charged with hosting and coordinating rule engines and machine learning models for code smell detection. The smell detection models are invoked through implementations of the IDetector interface, taking the CaDETProject as input, and outputting a set of identified issues.
Currently, our platform implements rule engines for the Large Class and Long Method code smells, hosting rules collected by Mayvan, Rasoolzadegan, and Jafari.
The module works with metrics which are calculated by the Code Parser. Class diagram is presented below.
ClassMetricRuleEngine, ClassHybridRuleEngine and MethodMetricRuleEngine are main classes in which rules are created and applied on given metrics in order to create SmellDetectionReport. The Rule class presents each rule from mentioned paper and uses Criteria interface in order to create a specific rule. Some rules are composed of different parts that are connected using logical operators. A part of a rule is represented by MetricCriteria class and is composed of a metric and relational operator and a threshold. AndCriteria and OrCriteria classes are used to connect these MetricCriteria using logical operators.
RuleEngine classes iterates through code snippets and applies rules to them. If code smell is detected by a rule, the Issue is created that contains information about a code snippet and which code smell is detected. When all rules are applied, the PartialSmellDetectorReport is created by all Issues that were found.