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

代码审查自动化:当前技术水平的长处与不足

Code Review Automation: Strengths and Weaknesses of the State of the Art

Rosalia Tufano, Ozren Dabić, Antonio Mastropaolo, Matteo Ciniselli, Gabriele Bavota

AI总结:

本文定性分析了三种代码审查自动化技术在评论代码变更和处理审查评论两项任务中的成功与失败情形,构建了两个分类体系,并发现训练数据集存在缺陷,同时证明专用技术优于通用大语言模型ChatGPT。

摘要:

为了降低成本,多位研究人员致力于解决代码审查自动化问题。深度学习在软件工程中的应用将该自动化推向了新的边界,相关技术能够在生成性任务中模仿开发者,例如像审查者那样对代码变更进行评论,或通过修改代码来处理审查者的评论。这些技术的性能通常通过定量指标来评估,例如在测试集中生成正确预测的实例百分比,但这在技术能力方面留下了许多悬而未决的问题。例如,仅仅知道某种方法在10%的情况下能够正确处理审查者的评论,而不知道审查者要求了什么,这几乎没有价值:如果在所有成功的案例中,处理评论所需的代码变更仅仅是删除一个空行呢?在本文中,我们旨在刻画三种代码审查自动化技术在上述两项任务中倾向于成功或失败的情形。该研究具有很强的定性焦点,投入了约105人小时进行手动检查,以分析这三种技术生成的正确和错误预测,共计检查了2,291个预测。该分析的输出是两个分类体系,分别针对这两项任务报告了所实验技术倾向于成功或失败的代码变更类型,指出了未来工作的方向。我们手动分析的另一个结果是在用于训练和测试所实验技术的数据集中发现了若干问题。最后,我们通过将专用技术的性能与通用大语言模型ChatGPT进行比较,评估了专门研究代码审查自动化技术的重要性,发现ChatGPT在像人类审查者那样评论代码方面存在困难。

英文摘要:

The automation of code review has been tackled by several researchers with the goal of reducing its cost. The adoption of deep learning in software engineering pushed the automation to new boundaries, with techniques imitating developers in generative tasks, such as commenting on a code change as a reviewer would do or addressing a reviewer's comment by modifying code. The performance of these techniques is usually assessed through quantitative metrics, e.g., the percentage of instances in the test set for which correct predictions are generated, leaving many open questions on the techniques' capabilities. For example, knowing that an approach is able to correctly address a reviewer's comment in 10% of cases is of little value without knowing what was asked by the reviewer: What if in all successful cases the code change required to address the comment was just the removal of an empty line? In this paper we aim at characterizing the cases in which three code review automation techniques tend to succeed or fail in the two above-described tasks. The study has a strong qualitative focus, with ~105 man-hours of manual inspection invested in manually analyzing correct and wrong predictions generated by the three techniques, for a total of 2,291 inspected predictions. The output of this analysis are two taxonomies reporting, for each of the two tasks, the types of code changes on which the experimented techniques tend to succeed or to fail, pointing to areas for future work. A result of our manual analysis was also the identification of several issues in the datasets used to train and test the experimented techniques. Finally, we assess the importance of researching in techniques specialized for code review automation by comparing their performance with ChatGPT, a general purpose large language model, finding that ChatGPT struggles in commenting code as a human reviewer would do.

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

↑