基于预训练模型和多层次信息的代码坏味检测方法

Translated title of the contribution: Code Smell Detection Approach Based on Pre-training Model and Multi-level Information

Yang Zhang*, Chun Hao Dong, Hui Liu, Chu Yan Ge

*Corresponding author for this work

Research output: Contribution to journalArticlepeer-review

3 Citations (Scopus)

Abstract

Most of the existing code smell detection approaches rely on code structure information and heuristic rules, while pay little attention to the semantic information embedded in different levels of code, and the accuracy of code smell detection approaches is not high. To solve this problem, this study proposes a novel approach DeepSmell based on a pre-trained model and multi-level metrics. Firstly, the static analysis tool is used to extract code smell instances and multi-level code metric information in the source program and mark these instances. Secondly, the level information that relate to code smells in the source code are parsed and obtained through the abstract syntax tree. The textual information composed of the level information is combined with code metric information to generate the data set. Finally, text information is converted into word vectors using the BERT pre-training model. The GRU-LSTM model is applied to obtain the potential semantic relationship among the identifiers, and the CNN model is combined with attention mechanism to code smell detection. The experiment tested four kinds of code smells including feature envy, long method, data class, and god class on 24 open source programs such as JUnit, Xalan, and SPECjbb2005. The results show that DeepSmell improves the average recall and F1 by 9.3% and 10.44% respectively compared with existing detection methods, and maintains a high level of precision at the same time.

Translated title of the contributionCode Smell Detection Approach Based on Pre-training Model and Multi-level Information
Original languageChinese (Traditional)
Pages (from-to)1551-1568
Number of pages18
JournalRuan Jian Xue Bao/Journal of Software
Volume33
Issue number5
DOIs
Publication statusPublished - May 2022

Fingerprint

Dive into the research topics of 'Code Smell Detection Approach Based on Pre-training Model and Multi-level Information'. Together they form a unique fingerprint.

Cite this