arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2602.11925cs.SE
收藏

通过人工和自动化代码审查研究质量改进

Studying Quality Improvements Recommended via Manual and Automated Code Review

Università della Svizzera italiana(瑞士意大利语大学)

Giuseppe Crupi, Rosalia Tufano, Gabriele Bavota

AI总结:

本文研究了人工和自动化代码审查在质量改进方面的互补性,发现基于DL的代码审查可作为补充,但无法替代人类审查。

摘要:

本文探讨了几种基于深度学习(DL)的技术如何自动化代码审查。然而,目前尚不清楚这些方法在推荐质量改进方面能有多大程度地替代人类审查员。我们通过比较人类和DL模型生成的代码审查之间的相似性和差异性,使用ChatGPT-4作为后者代表。具体来说,我们进行了一项基于挖掘的研究,在其中收集并手动检查了739条由人类审查员发布的评论,以建议240个拉取请求(PR)中的代码更改。手动检查旨在分类人类审查员推荐的质量改进类型(例如,重命名变量/常量)。然后,我们要求ChatGPT对相同的PR进行代码审查,并将LLM推荐的质量改进与人类审查员建议的质量改进进行比较。我们发现,尽管平均而言,ChatGPT推荐的代码更改数量比人类审查员多(约2.4倍),但它只能发现人类报告的质量问题的10%。然而,约40%的额外生成的评论指向有意义的质量问题。简而言之,我们的发现表明了人工和基于AI的代码审查的互补性。这一发现表明,在当前状态下,基于DL的代码审查可以作为人类审查的进一步质量检查,但不应被视为替代人类审查或节省代码审查时间的手段,因为人类审查员仍需要执行其手动检查,同时验证DL技术报告的质量问题。

英文摘要:

Several Deep Learning (DL)-based techniques have been proposed to automate code review. Still, it is unclear the extent to which these approaches can recommend quality improvements as a human reviewer. We study the similarities and differences between code reviews performed by humans and those automatically generated by DL models, using ChatGPT-4 as representative of the latter. In particular, we run a mining-based study in which we collect and manually inspect 739 comments posted by human reviewers to suggest code changes in 240 PRs. The manual inspection aims at classifying the type of quality improvement recommended by human reviewers (e.g., rename variable/constant). Then, we ask ChatGPT to perform a code review on the same PRs and we compare the quality improvements it recommends against those suggested by the human reviewers. We show that while, on average, ChatGPT tends to recommend a higher number of code changes as compared to human reviewers (~2.4x more), it can only spot 10% of the quality issues reported by humans. However, ~40% of the additional comments generated by the LLM point to meaningful quality issues. In short, our findings show the complementarity of manual and AI-based code review. This finding suggests that, in its current state, DL-based code review can be used as a further quality check on top of the one performed by humans, but should not be considered as a valid alternative to them nor as a mean to save code review time, since human reviewers would still need to perform their manual inspection while also validating the quality issues reported by the DL-based technique.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑