Detecting and Refactoring Feature Envy Based on Graph Neural Network

2022 IEEE 33rd International Symposium on Software Reliability Engineering (ISSRE)(2022)

引用 1|浏览18
暂无评分
摘要
As one of the most common code smells, feature envy reduces the cohesion of classes and increases the coupling between classes, thus leading to difficulty of software maintainability. Though many studies have made good achievements on feature envy detection, they often despise or even ignore the inherent calling relationships between methods, causing unimpressive detection efficiency. To address this problem, we propose a Graph Neural Network (GNN) based approach towards feature envy detection. We first collect code metrics and calling relationships, and then convert them to the form of a graph, where the node represents the code metrics of a method and the edge represents the calling relationship between methods. Particularly, considering the unbalance of positive and negative samples, we introduce a graph augmenter to obtain an enhanced graph. Finally, we feed the enhanced graph into a GNN model for training and predicting. We conducted extensive experiments on a dataset containing five open-source software projects. The result shows that our approach achieves 78.90% in terms of average F1-score, which is 37.98% absolutely higher than the best comparison approach. Besides, we propose a refactoring recommendation approach based on calling strength. It achieves 61.44% of accuracy, which is 5.13% absolutely higher than the best competitive. Our code and datasets are available at https://github.com/HduDBSI/Feature-Envy-Detection.
更多
查看译文
关键词
Code Smell,Feature Envy Detection,Refactoring,Graph Neural Network
AI 理解论文
溯源树
样例
生成溯源树,研究论文发展脉络
Chat Paper
正在生成论文摘要