Journal of Civil Aviation University of China ›› 2023, Vol. 41 ›› Issue (2): 14-20.

• Civil Aviation • Previous Articles     Next Articles

Detection method for code defect based on LSTM-Seq2Seq model with large perception

WANG Peng 1a, 2 , YAO Xinpeng 1a, 2 , WANG Kenian1a, 2 , CHEN Wenqi 1b, 2 , CHEN Xi 1a, 2   

  1. (1a. College of Safety Science and Engineering, 1b. Sino-European Institute of Aviation Engineering, CAUC, Tianjin 300300, China; 2. Key Lab of Civil Aircraft Airworthiness Technology, Tianjin 300300, China)
  • Received:2021-12-21 Revised:2022-03-14 Online:2023-10-28 Published:2023-10-28

Abstract:

Aiming at the problem that the existing deep neural network based code defect detection methods cannot analyze the defect characteristics and output relevant review suggestions, a code defect detection method based on LSTM-Seq2Seq model with large perception is proposed. Firstly, the long short-term memory network (LSTM) is applied to obtain the coding characteristics of defective code and establish a defect identification model.

Secondly, aiming at the mismatch between model and dataset, the code segment length coefficient is introduced into the sequence to sequence (Seq2Seq) model to improve the model applicability to the code review task. To realize the review output function, the code analysis model is constructed by establishing the mapping relationship between the features of code defect and the review recommendation. Finally, the method is verified by the open data set of SARD. The results show that the accuracy rate, recall rate and F1 vale of the proposed method are 92.50%, 87.20% and 87.60% respectively, and the similarity between the output review of typical code defect and the expert review is 85.99%, which can effectively reduce the dependence on expert experience in the review process

Key words: font-size:15.04px, ">defect detection, code review, long short-term memory (LSTM), sequence to sequence (Seq2Seq)

CLC Number: