Multi-Granularity Code Smell Detection using Deep Learning Method based on Abstract Syntax Tree
Weiwei Xu
Abstract
smell refers to poor design that is perceived to have a negative impact on readability and maintainability during software evolution, and it implies the possibility of refactoring. Therefore, the effective detection of code smell is of great importance. Many approaches including metric-based, heuristic-based, and machine learning approaches have been proposed to detect code smells. However, all these methods use manually selected features, which is highly subjective and difficult to select the most appropriate features. Recently, deep learning methods without extensive feature engineering have been proposed. Nevertheless, these token-based approaches may not achieve good results because they ignore many semantic and structural information of source code. To this end, we propose a novel deep learning approach based on abstract syntax trees(ASTs) to detect multi-granularity code smells, which captures the semantic and structural features of code fragments from the ASTs. The experimental results on four types of smells show that this approach achieves better results than the stateof-the-art approaches for detecting code smells with different granularities.