Code Smell Detection and Classification Using AI and Data Mining Techniques

Authors

  • Faiez Musa Lahmood Alrufaye Middle Technical University, Technical Instructors Training Institute, Institute St., Al-Zafaraniyah District, Baghdad, 10074, Iraq
  • Mohammed Muanis Ismael Al-Saghee University of Basra, College of Nursing - Branch of Basic Science, Basra, Basra, Iraq

DOI:

https://doi.org/10.15575/join.v11i2.1857

Keywords:

Code smells, Data mining, IDE, Monitoring-Aware IDEs, Software Engineering

Abstract

One of the key elements influencing the effectiveness of information systems and their capacity to develop and sustain over time is software quality. "Code smells" emerge when software projects grow in size and complexity. These are early warning signs of design issues that may not directly result in mistakes but have an impact on maintenance and comprehension. The issue is that, particularly in widely used Python projects, the majority of conventional analytic tools depend on preset criteria, which results in poor detection accuracy and High false-positive rates. The goal of this work is to create an intelligent system that uses data mining and machine learning methods to automatically identify code smells in Python projects. This system was incorporated into an integrated development environment (IDE) to provide programmers instant warnings as they write code. The suggested approach categorizes the code smells into several groups including Long Method, God Class, and Feature Envy after extracting structural and historical data from 100 open-source projects. According to the findings, the system classified smells with an average accuracy of 93% and an average F1-Score of 92%. The Graph Neural Network model beat the other models, obtaining an accuracy of 94%. The system was validated through real-world testing in the IDE, confirming that the system significantly reduces maintenance time and improves real-time detection by more than 35% compared to conventional techniques. These results show that the proposed methodology supports the software quality and enhances the code maintainability.

References

[1] M. A. Sawsan Alodibat, “A Systematic Review on Code Smell Detection Approaches in Open Source Projects,” J. Softw. Pract. Exp., vol. 56, no. 7, pp. 847–877, 2026, doi: 10.1002/spe.70074.

[2] J. Domingues, D. Duarte, S. António, and N. Pombo, “AI4SE for CI/CD: Explainable Code Smell Risk Analysis,” in 2026 IEEE International Conference on Artificial Intelligence Testing (AITest), 2026, pp. 50–55, doi: 10.1109/AITest70988.2026.00017.

[3] J. Slamet and S. Rochimah, “Development of code smell detection model based on graph neural network to detect long method, large class, and duplicated code,” Edelweiss Appl. Sci. Technol., vol. 9, no. 7, pp. 566–579, 2025, doi: 10.55214/25768484.v9i7.8672.

[4] O. Hamdi, A. Ouni, M. Ó. Cinnéide, and M. W. Mkaouer, “A longitudinal study of the impact of refactoring in android applications,” Inf. Softw. Technol., vol. 140, p. 106699, 2021, doi: https://doi.org/10.1016/j.infsof.2021.106699.

[5] M. I. Azeem, F. Palomba, L. Shi, and Q. Wang, “Machine learning techniques for code smell detection: A systematic literature review and meta-analysis,” Inf. Softw. Technol., vol. 108, pp. 115–138, 2019, doi: https://doi.org/10.1016/j.infsof.2018.12.009.

[6] M. G. Al-Obeidallah and D. Al-Fraihat, “A systematic review on software code smells,” Int. J. Electr. Comput. Eng., vol. 15, no. 3, p. 3010~3027, 2025, doi: 10.11591/ijece.v15i3.pp3010-3027.

[7] B. M. Kocakaplan, E. Borandağ, Y. Özçevik, F. Yücalar, and O. Altay, “QualiGuard: An AI-driven risk-based quality gate for defect prediction and code smell detection in DevOps pipelines,” SoftwareX, vol. 36, p. 103090, 2026, doi: https://doi.org/10.1016/j.softx.2026.103090.

[8] A. Alazba, H. Aljamaan, and M. Alshayeb, “Deep learning approaches for bad smell detection: a systematic literature review,” Empir. Softw. Eng., vol. 28, no. 3, p. 77, 2023, doi: 10.1007/s10664-023-10312-z.

[9] F. Palomba, G. Bavota, M. Di Penta, R. Oliveto, D. Poshyvanyk, and A. De Lucia, “Mining Version Histories for Detecting Code Smells,” IEEE Trans. Softw. Eng., vol. 41, no. 5, pp. 462–489, 2015, doi: 10.1109/TSE.2014.2372760.

[10] Y. Zhang, C. Ge, H. Liu, and K. Zheng, “Code smell detection based on supervised learning models: A survey,” Neurocomputing, vol. 565, p. 127014, 2024, doi: https://doi.org/10.1016/j.neucom.2023.127014.

[11] C. Kumar, V. Chaganti, U. Samal, and S. K. Singh, “CodeSmellSynergy hybrid ensemble learning framework for detecting python code smells,” Discov. Comput., vol. 29, no. 1, p. 171, 2026, doi: 10.1007/s10791-026-10055-7.

[12] G. O. Report, “Programming Languages Trends,” GitHub, 2023. .

[13] P. S. Yadav, R. S. Rao, A. Mishra, and M. Gupta, “Machine Learning-Based Methods for Code Smell Detection: A Survey,” Appl. Sci., vol. 14, no. 14, 2024, doi: 10.3390/app14146149.

[14] A. Ho, A. M. T. Bui, P. T. Nguyen, A. Di Salle, and B. Le, “EnseSmells : Deep ensemble and programming language models for automated code smells detection,” J. Syst. Softw., vol. 224, p. 112375, 2025, doi: https://doi.org/10.1016/j.jss.2025.112375.

[15] J. Maarleveld, J. Guo, and D. Feitosa, “A systematic mapping study on graph machine learning for static source code analysis,” Inf. Softw. Technol., vol. 183, p. 107722, 2025, doi: https://doi.org/10.1016/j.infsof.2025.107722.

[16] K. Sharma and J. K. Chhabra, “Software design smells prediction using machine learning with evolutionary and structural metrics of source code,” J. Comput. Lang., vol. 86, p. 101373, 2026, doi: https://doi.org/10.1016/j.cola.2025.101373.

[17] A. W. Claes Wohlin , Per Runeson , Martin Höst , Magnus C. Ohlsson , Björn Regnell, Experimentation in Software Engineering, 1st editio. Springer, 2012.

[18] Kim Tae Kyun, “T test as a parametric statistic,” Korean J Anesth., vol. 68, no. 6, pp. 540–546, 2015, doi: 10.4097/kjae.2015.68.6.540.

[19] F. Wilcoxon, “Individual Comparisons by Ranking Methods,” Biometrics Bull., vol. 1, no. 6, pp. 80–83, Nov. 1945, doi: 10.2307/3001968.

[20] J. Romano, J. D. Kromrey, J. Coraggio, and J. Skowronek, “Appropriate statistics for ordinal level data: Should we really be using t-test and Cohen’sd for evaluating group differences on the NSSE and other surveys?,” in annual meeting of the Florida Association of Institutional Research, 2006, pp. 1–3.

[21] J. Demšar, “Statistical Comparisons of Classifiers over Multiple Data Sets,” J. Mach. Learn. Res., vol. 7, no. 1, pp. 1–30, 2006, [Online]. Available: http://jmlr.org/papers/v7/demsar06a.html.

[22] S. Holm, “A Simple Sequentially Rejective Multiple Test Procedure,” Scand. J. Stat., vol. 6, no. 2, pp. 65–70, Nov. 1979, [Online]. Available: http://www.jstor.org/stable/4615733.

[23] R. Dror, G. Baumer, S. Shlomov, and R. Reichart, “The Hitchhiker{’}s Guide to Testing Statistical Significance in Natural Language Processing,” in Proceedings of the 56th Annual Meeting of the {A}ssociation for {C}omputational {L}inguistics (Volume 1: Long Papers), 2018, pp. 1383–1392, doi: 10.18653/v1/P18-1128.

[24] T. Sharma, P. Mishra, and R. Tiwari, “Designite: a software design quality assessment tool,” in Proceedings of the 1st International Workshop on Bringing Architectural Design Thinking into Developers’ Daily Activities, 2016, pp. 1–4, doi: 10.1145/2896935.2896938.

[25] A. Boloori and T. Sharma, “DPy: Code Smells Detection Tool for Python,” in 2025 IEEE/ACM 22nd International Conference on Mining Software Repositories (MSR), 2025, pp. 826–830, doi: 10.1109/MSR66628.2025.00119.

[26] E. Haroon, K. T. Wassif, and L. A. Zaid, “From code to insight: studying code representation techniques for ML-based God class detection to support intelligent IDEs,” Autom. Softw. Eng., vol. 32, no. 2, p. 66, 2025, doi: 10.1007/s10515-025-00534-4.

Downloads

Published

2026-12-05

Issue

Section

Article

Citation Check