Skip to content
Open access

Machine Learning for Code Smell Detection and Resolution

2020 · International Journal of Machine Learning and Predictive Analytics · 0 citations

TL;DR

The study highlights the potential of intelligent, data-driven approaches to enhance software quality and support continuous code improvement by leveraging code metrics, syntactic and semantic features, and historical refactoring data.

Abstract

Code smells are indicative of poor software design, maintainability issues, or potential defects, and their early detection is critical for high-quality software development. Traditional detection methods rely heavily on manual inspection or rule-based static analysis, which are often time-consuming, error-prone, and limited in adaptability. This paper explores the use of machine learning techniques for automated code smell detection and resolution. By leveraging code metrics, syntactic and semantic features, and historical refactoring data, ML models can identify patterns associated with common code smells and recommend targeted resolution strategies. The proposed approach is evaluated on open-source and industrial software projects, demonstrating improvements in detection accuracy, maintainability, and developer productivity. The study highlights the potential of intelligent, data-driven approaches to enhance software quality and support continuous code improvement.

Read PDF

Similar papers

Open access 2026

Fine-Tuning UniXcoder for Code Smell Detection in Java Projects

Code smells are symptoms of poor software design that hinder maintainability and increase technical debt interest. Automated detection of code smells is crucial in software development industry, where manual inspection is costly and error-prone. Although several studies have explored code smell detection, most existing approaches, both structural/metric-based and textual/transformer-based, still exhibit limitations in capturing the semantic context of source code to handle complex smells effectively. This study investigates the application of UniXcoder, a pre-trained transformer model for source code, to classify Java source code methods across multiple projects as smell or clean, with a particular focus on the Switch Statements smell. The proposed method fine-tunes UniXcoder and evaluates its performance using standard metrics, namely accuracy, precision, recall, and F1-score, in comparison with traditional machine learning models based on structural metrics and textual representations. Experimental results show that the fine-tuned UniXcoder achieves the highest classification accuracy of 80.2%, the highest precision among all baseline methods evaluated, indicating its effectiveness in minimizing false positives. These findings confirm that pre-trained transformer models, particularly UniXcoder, are capable of understanding both the semantic and syntactic structures of code and demonstrate stronger performance than frequency-based textual representation approaches as well as software metrics-based approaches. Furthermore, the results highlight UniXcoder’s potential for integration into industrial software engineering workflows, supporting automated code smell detection as part of continuous code quality assurance.

Hanson Prihantoro Putro, Umi Laili Yuhana, E. M. Yuniarno et al. · 0 citations
Preprint Aug 2026

SmellCC: A Tool for Automated Code Smells Remediation

SmellCC, a Visual Studio Code extension that augments SonarQube with an LLM-based pipeline to automatically detect and refactor Python code smells, provides in-place, one-click remediation for the top-10 most frequent smells, effectively preventing the accumulation of technical debt during development.

Xiaoting Zhang, Yujie Zhang, Zhi-Peng Gao et al. · 0 citations
Review Open access 2019

ML-Enhanced Code Refactoring Recommendations for Improving Software Maintainability

Results show that ML-enhanced recommendations outperform traditional methods in accuracy, relevance, and impact on maintainability metrics, and highlight the potential of integrating ML into modern development practices to support developers in producing cleaner, more maintainable software systems.

Rohit Malhotra · 0 citations
Open access Aug 2026

An Exploratory Study on Code Smells Detection and Refactoring using LLMs

This paper focuses on four common smells and considers five prompts of diverse complexity, asking the model for detecting and removing the identified code smells, and suggests that general-purpose LLMs cannot be reliably used for that.

Giorgia Paisi, Francesca Arcelli Fontana, Bartosz Walter · 0 citations
Review Aug 2026

Intelligent automated code review and software quality evaluation: a survey of AutoML and large language model techniques

This survey synthesises research from 2020 to 2026 on AI-driven techniques for code review and software quality evaluation, focusing on two complementary paradigms: Automated Machine Learning (AutoML) and Large Language Models (LLMs).

R. Borgalli, Uma Raj, Shwetha Shetty · 0 citations
Conference Jul 2026

Understanding and Reducing Code Smells in AI-Generated Java Code Using Explainable AI and Prompt Optimization

Recently, Developers have been relying on AI tools to support them in their daily work by generating code. While the use of large language model-based AI tools has improved productivity, the quality of the generated code wasn't always optimal. In a lot of cases, the code includes design issues known as code smells, which negatively impact readability, maintainability, and future development. This paper investigates these issues in AI-generated Java code, with a focus on common object-oriented problems such as switch statements, temporary fields, and refused bequest. A structured approach is proposed that combines static analysis tools with explainable AI techniques to better understand why these problems appear. Based on the realized insights, prompts are optimized to guide the AI model towards generating cleaner and more structured code. The results showed clear improvement after the prompt optimization, where the number of detected code smells was reduced by 66%, and completely removed (100% reduction) in some cases. Overall, the study showed that improving prompt design, supported by explainable analysis, can significantly enhance the quality of AI-generated code.

Y. Younes, Yousef Elsheikh · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.