Comparing Structural Quality of Code Generated by LLMs: A Static Analysis of Code Smells
- 29 September 2025
- conference paper
- Published by Sociedade Brasileira de Computação
- p. 391-402
Abstract
The automation of code generation through Large Language Models (LLMs) has emerged as a promising approach to support software development. However, concerns remain regarding the structural quality of the code produced, particularly the presence of code smells that affect maintainability. This paper presents an empirical study comparing code smells in outputs from four major LLMs: ChatGPT, DeepSeek, Amazon CodeWhisperer, and GitHub Copilot. Our analysis of 64 code units, generated from open-source projects, revealed that 60.9% contained at least one code smell. The results show significant variation, with DeepSeek having the lowest incidence of smells (43.8%) and Amazon CodeWhisperer the highest (68.8%). Long Method was the most frequent smell, constituting 40% of all occurrences. These findings provide empirical evidence of the structural quality differences in LLM-generated code and highlight the need for rigorous, automated quality assurance.Keywords
This publication has 21 references indexed in Scilit:
- How Propense Are Large Language Models at Producing Code Smells? A Benchmarking Study2025
- An Empirical Study of Code Smells in Transformer-based Code Generation Techniques2022
- A snowballing literature study on test amplificationJournal of Systems and Software, 2019
- Cyclomatic ComplexityIEEE Software, 2016
- Achievements, Open Problems and Challenges for Search Based Software Testing2015
- Do code smells reflect important maintainability aspects?2012
- A Bayesian Approach for the Detection of Code and Design Smells2009
- Detection strategies: metrics-based rules for detecting design flaws2004
- Impact analysis and change management of UML models2004
- A metrics suite for object oriented designIEEE Transactions on Software Engineering, 1994