Recent research from GitClear and Alloy.dev has uncovered concerning trends in code quality as AI coding assistants become increasingly prevalent in software development.
Whilst AI may provide initial boosts in productivity, the study raises questions about the long-term impact on code quality and maintainability.
Their comprehensive analysis of 211 million lines of code reveals that while AI is dramatically increasing code output, it may be creating significant technical debt that could plague software projects for years to come.
A shift in coding practices
The report found that 2024 marked a historic shift in how developers write and modify code. For the first time ever, copy-pasted code exceeded refactored (moved) code in repositories.
While traditionally developers would consolidate similar functionality into reusable modules, the data shows a sharp decline in this practice, with refactoring dropping from 25% of code changes in 2021 to less than 10% in 2024.
An explosion in code duplication
The research found that commits containing duplicate code blocks increased by an astounding 800% during 2024, with approximately 6.66% of commits containing substantial duplicated sections. This represents a tenfold increase compared to just two years prior.
Year | Commits scanned | Total dupe blocks found | Commits containing dupe block | Duplicate block % | Median dupe block size |
---|---|---|---|---|---|
2020 | 19,805 | 9,227 | 139 | 0.70% | 10 |
2021 | 29,912 | 9,295 | 143 | 0.48% | 11 |
2022 | 40,010 | 10,685 | 182 | 0.45% | 11 |
2023 | 41,561 | 20,448 | 747 | 1.80% | 10 |
2024 | 56,495 | 63,566 | 3,764 | 6.66% | 10 |
The impact on code quality
According to studies cited in the research, around 57% of co-changed clones are involved in bugs, meaning that when developers modify one instance of duplicated code, they often introduce errors by failing to update all copies consistently.
This helps explain why Google's 2024 DORA report found that for every 25% increase in AI adoption, there was a 7.2% decrease in delivery stability.
Implications for testing
The solution isn't to abandon AI coding assistants – their benefits are clear and their adoption appears inevitable. Rather, organizations need to invest in modern automated testing tools that can keep pace with AI-accelerated development.
This research serves as a wake-up call for the software industry. While AI promises to revolutionize how we write code, we must ensure that we're not sacrificing long-term maintainability for short-term productivity gains. The true measure of a development team's success isn't how quickly they can write new code, but how effectively they can maintain and evolve their systems over time.
The challenge for 2025 and beyond will be finding the right balance between leveraging AI's capabilities while preserving the human-driven practices that make software reliable and maintainable. Organizations that can strike this balance will be best positioned to build sustainable, high-quality software in the AI era.
A huge thanks to GitClear for sharing their research and helping us all understand the impact of AI on code quality.
With Carbonate you can generate and run automated, self-healing tests just by using your application.