EconPapers    
Economics at your fingertips  
 

Development of code smell detection model based on graph neural network to detect long method, large class, and duplicated code

Joko Slamet () and Siti Rochimah ()

Edelweiss Applied Science and Technology, 2025, vol. 9, issue 7, 566-579

Abstract: This study aims to develop and evaluate a GNN-based model for automatically detecting code smells in Python by leveraging the structural information derived from Abstract Syntax Trees (ASTs). The study employed a quantitative approach by training a Graph Neural Network (GNN) model on code represented as Abstract Syntax Trees (ASTs). The proposed GNN model demonstrated high effectiveness in detecting specific types of code smells using a processed dataset, achieving 96.3% accuracy for Long Method detection and 95.2% for Large Class detection. Furthermore, the model effectively identified Long Method, Large Class, and Duplicated Code when tested on real-world datasets. On the ERPNext dataset, it reached 95.95% accuracy, 99.84% precision, 95.95% recall, and 97.78% F1-score. On the Odoo dataset, it attained 93.29% accuracy, 99.74% precision, 93.29% recall, and 96.29% F1-score. These results show that the proposed GNN model outperformed traditional machine learning algorithms such as Decision Tree, Random Forest, Support Vector Machine (SVM), Stochastic Gradient Descent (SGD), Multi-Layer Perceptron (MLP), and Linear Regression. The results confirm that the GNN-based approach effectively detects code smells in Python programs, surpassing classical machine learning techniques. This model provides a practical tool for enhancing code quality and maintainability. Future work could explore real-time integration of this model into development environments and expand detection to other code smell types.

Keywords: Code smell detection; Duplicated code; Graph neural network; Large class; Long method; Python programming language. (search for similar items in EconPapers)
Date: 2025
References: Add references at CitEc
Citations:

Downloads: (external link)
https://learning-gate.com/index.php/2576-8484/article/view/8672/2905 (application/pdf)

Related works:
This item may be available elsewhere in EconPapers: Search for items with the same title.

Export reference: BibTeX RIS (EndNote, ProCite, RefMan) HTML/Text

Persistent link: https://EconPapers.repec.org/RePEc:ajp:edwast:v:9:y:2025:i:7:p:566-579:id:8672

Access Statistics for this article

More articles in Edelweiss Applied Science and Technology from Learning Gate
Bibliographic data for series maintained by Melissa Fernandes ().

 
Page updated 2025-07-09
Handle: RePEc:ajp:edwast:v:9:y:2025:i:7:p:566-579:id:8672