New GitHub Copilot Research Finds 'Downward Pressure on Code Quality'
New research on the effect of AI-powered GitHub Copilot on software development cites some adverse results.
The "Coding on Copilot" whitepaper from GitClear sought to investigate the quality and maintainability of AI-assisted code compared to what would have been written by a human. In other words: "Is it more similar to the careful, refined contributions of a Senior Developer, or more akin to the disjointed work of a short-term contractor?"
The answer to that is summarized in this paragraph from the whitepaper's abstract:
"We find disconcerting trends for maintainability. Code churn -- the percentage of lines that are reverted or updated less than two weeks after being authored -- is projected to double in 2024 compared to its 2021, pre-AI baseline. We further find that the percentage of 'added code' and 'copy/pasted code' is increasing in proportion to 'updated,' 'deleted,' and 'moved 'code. In this regard, AI-generated code resembles an itinerant contributor, prone to violate the DRY-ness [don't repeat yourself] of the repos visited."
That serves as a counterpoint to findings of some other studies, including one from GitHub in 2022 that found, for one thing: "developers who used GitHub Copilot completed the task significantly faster -- 55 percent faster than the developers who didn't use GitHub Copilot." That study was noted in the new whitepaper from GitClear, which sells a cloud-based code review tool. In addition to productivity, the GitHub study also measured positive effects in developer satisfaction and conserving mental energy.
GitClear's research, however, investigated "how the composition of code changes when AI is used." GitClear said its report sheds light on:
- What are the three significant changes since Copilot's introduction?
- What do Technical Leaders need to be on the lookout for 2024?
- How can you measure the impact of AI on your team's code quality?
Regarding that first item, the paper indicated the three most significant changes associated with Copilot's rise concerned "Churn" and "Moved" and "Copy/Pasted" code:
- Burgeoning Churn: "The bottom line is that 'using Copilot' is strongly correlated with 'mistake code' being pushed to the repo."
- Less Moved Code Implies Less Refactoring, Less Reuse: "Combined with the growth in code labeled 'Copy/Pasted,' there is little room to doubt that the current implementation of AI Assistants discourages code reuse. Instead of refactoring and working to DRY ('Don't Repeat Yourself') code, these Assistants offer a one-keystroke temptation to repeat existing code."
- More Copy/Pasted Code Implies Future Headaches: "There is perhaps no greater scourge to long-term code maintainability than copy/pasted code. In effect, when a non-keyword line of code is repeated, the code author is admitting 'I didn't have the time to evaluate the previous implementation.' By re-adding code instead of reusing it, the chore is left to future maintainers to figure out how to consolidate parallel code paths that implement repeatedly-needed functionality."
The paper concludes: "How will Copilot transform what it means to be a developer? There's no question that, as AI has surged in popularity, we have entered an era where code lines are being added faster than ever before. The better question for 2024: who's on the hook to clean up the mess afterward?"
Some other studies on the topic include:
For its study, GitClear collected and analyzed 153 million changed lines of code, authored between January 2020 and December 2023.
David Ramel is an editor and writer for Converge360.