Are AI Coding Assistants Undermining Code Quality? New Study Reveals Alarming Trends
A recent GitClear analysis of 211 million lines of code shows AI coding assistants are increasing duplicated and copy‑paste code while reducing refactoring, leading to poorer code quality despite claims of productivity gains, and highlights the need for guidelines to mitigate these risks.
GitClear's latest research, based on analysis of 211 million lines of code, indicates that AI coding assistants are lowering code quality by increasing duplicate and copy‑paste code while reducing refactoring.
The researchers found that during 2024 the number of code blocks with five or more duplicate lines grew eightfold. Duplicate code may run correctly, but it is usually a sign of poor quality because it adds bloat, shows a lack of clear structure, and raises the risk of defects when the same code is updated in one place but not another.
GitClear added that functions called from many different locations are more "battle‑tested" than copy‑paste snippets.
They also noted a 39.9% decrease in the number of moved code lines. Code movement is evidence of refactoring, which improves quality without changing functionality. According to GitClear, the ability to consolidate previous work into reusable modules is a key advantage human programmers have over AI assistants. 2024 is the first year that copy‑paste lines exceeded moved lines.
GitClear's study shows that the amount of new and copied code is rising, while the amount of refactoring is falling.
GitClear explains that the reason is AI assistants can insert new code blocks with a single Tab press.
AI is less likely to suggest reusing similar functions elsewhere because its context window is limited, restricting the amount of surrounding code it can consider.
In contrast, Google's 2024 DORA "State of DevOps" report claims that AI adoption has improved code quality by 3.4%, but also notes a 7.2% drop in delivery stability.
These reports are not as contradictory as they appear. At the individual code‑block level, AI assistance may boost quality, but DORA researchers argue that because AI enables developers to deliver more code faster, larger changes become more common, leading to slower, less stable releases.
The impact of AI on coding can be viewed from different angles: supporters (and AI vendors) point to productivity gains that most developers acknowledge, while skeptics highlight the negative effects on code maintainability.
As Google has shown, while it is easy to talk about AI benefits, organizations should establish guidelines for AI use to address these issues; otherwise, tools that encourage poor practices will inevitably increase them unless they are improved.
Related reading:
Programmers, is AI making you dumber?
5 new AI tools that are starting to replace humans
Scientists are breaking down C to convert code to Rust
21CTO
21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
