Detecting code smells in software systems is crucial for maintaining and evaluating their quality. Code smells are structural issues in the code that can make it harder to understand, modify, and ultimately lead to bugs. Many researchers have used machine learning (ML) techniques for automatic code smell detection. However, the effectiveness of these techniques depends majorly on the representation of the source code. This paper evaluates various code representation techniques, such as CodeBERT, CuBERT, and Code2vec, for the representation of the source code for effective code smell detection. These techniques convert source code into numerical vectors to understand the code’s structure and semantics. We then employed various ML methods to build models that predict code smells. We assessed the presented techniques on four publicly available code smell datasets within the MLCQ repository. The results suggest that Code2vec embeddings were generally more accurate, achieving the highest F1 scores (ranging from 0.690 to 0.726) for Datasets 1, 2, and 3. However, Dataset 4 showed an exception. Here, CodeBERT performed better, achieving an F1-score of 0.774 compared to Code2vec’s 0.669.

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Evaluating Deep Learning Embedding Techniques for Code Smell Detection

  • Praveen Singh Thakur,
  • Mahipal Jadeja,
  • Satyendra Singh Chouhan,
  • Santosh Singh Rathore

摘要

Detecting code smells in software systems is crucial for maintaining and evaluating their quality. Code smells are structural issues in the code that can make it harder to understand, modify, and ultimately lead to bugs. Many researchers have used machine learning (ML) techniques for automatic code smell detection. However, the effectiveness of these techniques depends majorly on the representation of the source code. This paper evaluates various code representation techniques, such as CodeBERT, CuBERT, and Code2vec, for the representation of the source code for effective code smell detection. These techniques convert source code into numerical vectors to understand the code’s structure and semantics. We then employed various ML methods to build models that predict code smells. We assessed the presented techniques on four publicly available code smell datasets within the MLCQ repository. The results suggest that Code2vec embeddings were generally more accurate, achieving the highest F1 scores (ranging from 0.690 to 0.726) for Datasets 1, 2, and 3. However, Dataset 4 showed an exception. Here, CodeBERT performed better, achieving an F1-score of 0.774 compared to Code2vec’s 0.669.