Luigi Lavazza, Università degli Studi dell’Insubria, Italy
Gabriele Rotoloni, Università degli Studi dell’Insubria, Italy
Code smells are indicators of poor software structure and organization, suggesting potential maintenance challenges and future issues. To enhance code quality and eliminate these smells, developers often engage in code refactoring, which involves restructuring existing code without altering its external behavior. This process, while essential, can be time-consuming and may not require advanced programming skills. Recent advancements in large language models (LLMs) have prompted investigations into their ability to automate code refactoring.This paper presents an experimental evaluation of LLMs' capabilities in refactoring code within development environments that utilize test cases for code units. Recognizing the risk of regression—where changes inadvertently disrupt previously functioning features—developers typically establish a comprehensive set of test cases for each software unit. Our approach leverages automatic code smell detection tools alongside existing test cases to streamline the refactoring process, maximizing automation while maintaining code integrity. The findings of this study contribute to the objectives of the conference by addressing the impact of AI on software development; specifically, the paper contributes to the exploration of LLMs' potential to enhance code quality through automated refactoring techniques.