Report Summary: GitClear AI Code Quality Research 2025

2025-02-09 | 6 min | 1041 words | Jonas

PDF Download: 2025 AI Copilot Code Quality Report

Introduction

AI code assistants have become increasingly prevalent, with 63% of professional developers using AI in their workflow in 2024, according to Stack Overflow. The primary motivation behind this adoption is increased productivity—AI tools enable developers to generate more code quickly. However, this emphasis on speed may come at the expense of long-term maintainability.

This study evaluates how AI-generated code has impacted maintainability and defect rates using a database of 211 million lines of structured code change data from 2020 to 2024. The findings indicate a concerning rise in duplicated code and a decline in best practices such as code reuse and refactoring, leading to increased long-term maintenance costs.

Growing Evidence that AI-Generated Code Optimizes for the Short-Term

AI-assisted code has contributed to a measurable decline in code quality. In 2024, there was a marked increase in the frequency of copy-pasted code, surpassing the number of refactored (or “moved”) lines for the first time. This shift suggests that developers are focusing more on rapid feature implementation rather than long-term maintainability.

Google’s 2024 DevOps Research and Assessment (DORA) report corroborates these findings, showing a correlation between increased AI adoption and a rising defect rate. Google’s analysis estimated a 7.2% decrease in delivery stability for every 25% increase in AI adoption.

Trends in Code Changes: 2020-2024

An analysis of the 211 million lines of code revealed the following key trends:

These trends indicate that AI-assisted coding may be encouraging less structured development practices, with a focus on immediate output over sustainable architecture.

The Rise of Code Duplication and Its Consequences

A key issue emerging from AI-generated code is the proliferation of duplicate blocks. In 2024, the occurrence of duplicated code blocks rose eightfold compared to previous years. This phenomenon poses several risks:

  1. Increased Maintenance Burden: When developers need to modify duplicated code, they must manually update multiple instances, increasing the risk of inconsistency and errors.
  2. Bug Propagation: Research suggests that duplicated code is more likely to introduce defects. A 2023 study found that 57.1% of co-changed cloned code was involved in bugs.
  3. Long-Term Costs: Code duplication leads to technical debt, making future modifications more complex and expensive.

Historically, best practices like the DRY (Don’t Repeat Yourself) principle have emphasized refactoring and modularization to improve maintainability. The shift towards AI-generated, copy/pasted code threatens these principles, leading to codebases that are harder to manage and more error-prone.

Corroboration with Google’s 2024 DORA Benchmarks

Google’s DORA report provided empirical evidence of the impact of AI on software delivery performance. Despite AI being perceived as a productivity booster, the research found a decline in overall software quality. Developers reported increased defect rates and reduced software stability, contradicting the assumption that AI-driven development would lead to better outcomes.

One possible explanation for this contradiction is that AI generates more code but does not inherently enforce best practices such as code reuse, modularity, and thorough testing. Instead, AI-generated code often prioritizes short-term efficiency over long-term sustainability.

The Decline in Code Longevity

Another observed trend is the decreasing lifespan of written code. The percentage of revised code that was originally written more than a month prior dropped from 30% in 2020 to just 20% in 2024. This suggests that developers are spending more time modifying recently written AI-generated code rather than improving or refactoring legacy systems.

This shift could indicate:

Churn in Newly Added Code

Further analysis showed that the churn rate for new code has increased significantly. In 2024, 7.9% of all newly added code was revised within two weeks, compared to just 5.5% in 2020. This suggests that developers are frequently modifying or correcting recently written AI-generated code, reinforcing the concern that AI might be optimizing for speed rather than accuracy.

AI and the Future of Software Development

While AI-assisted development tools offer significant advantages in terms of productivity, the findings of this study highlight several critical risks:

  1. Erosion of Best Practices: The growing reliance on AI for code generation has led to a decline in practices like refactoring and modularization.
  2. Rising Maintenance Costs: The increase in duplicated code and code churn suggests that long-term maintenance efforts will be more resource-intensive.
  3. Higher Defect Rates: Empirical data from Google’s DORA report and other studies show a direct correlation between increased AI adoption and rising defect rates.
  4. Short-Term Optimization: AI-generated code prioritizes immediate productivity but often lacks the structure and maintainability required for long-lived software projects.

Conclusion: The Human Advantage in Code Quality

Despite the increasing capabilities of AI, human developers still have a crucial advantage in software maintainability. AI excels at generating boilerplate and repetitive code, but it lacks the nuanced understanding required for strategic refactoring, code consolidation, and long-term architectural planning.

To mitigate the risks associated with AI-generated code, developers and engineering leaders should:

By focusing on these strategies, organizations can continue leveraging AI’s strengths while mitigating its weaknesses. The future of AI-assisted development will depend on balancing speed with sustainability, ensuring that increased productivity does not come at the cost of long-term code quality.