Automatic Detection of Bad Smells from Code Changes
Maen M. Hammad, Asma Labadi · International Review on Computers and Software (IRECOS) · 2016
Code bad smells are indicators of code bad design that affects its quality attributes like understandability and readability. This effect has a direct impact on future maintenance tasks and code changing activities. Badly written code is hard to understand, change and test. The goal of this paper is to present an approach, supported by a tool, to automatically detect bad smells from code changes on the fly during code changing activities. An Eclipse plug-in tool (JFly) is developed to realize the approach. The tool analyzes code changes, detects bad smells and notifies developers about the location and the type of the detected bad smell. Nine bad smells are detected by JFly. A set of bad smells rules is defined, based on software metrics, to determine if code changes have one or more bad smells. JFly has been tested by different scenarios to evaluate its performance, usability and correctness. Results showed that JFly is very fast, easy to use and achieved high recall and precision values. By providing the JFly tool, developers are kept aware about code bad smells as soon as they implemented. As a result, the code is kept clean without the need to go over it periodically to check bad smells which consumes time and effort.