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

代码审查活动预测及其在实践中影响的实证研究

An Empirical Study on Code Review Activity Prediction and Its Impact in Practice

Doriane Olewicki, Sarra Habchi, Bram Adams

AI总结:

本文研究代码审查中的文件活动预测,结合代码嵌入与审查过程特征预测需评论、修改或属于热点的文件,并在开源与工业数据集上验证其优于现有方法。

摘要:

在代码审查这一软件质量保证的关键步骤中,审查者面临着理解和评估代码变更以验证其质量并防止向代码库引入故障的艰巨任务。这是一个繁琐的过程,所需精力高度依赖于提交的代码以及作者和审查者的经验,导致审查反馈的中位等待时间为15至64小时。通过对29位专家开展的初步用户研究,我们发现在审查环境中对补丁所变更的文件进行重新排序具有提升审查质量的潜力:与字母数字排序相比,参与者会写出更多评论(增加23%),且其文件级热点精确率和召回率分别提升至53%(增加13%)和28%(增加8%)。因此,本文旨在通过预测已提交补丁中哪些文件需要(1)被评论、(2)被修改,或(3)属于热点(被评论或被修改),来帮助代码审查者。为预测这些任务,我们评估了两种不同类型的文本嵌入(即词袋和大型语言模型编码)以及审查过程特征(即基于代码规模和基于历史的特征)。我们在三个开源数据集和两个工业数据集上的实证研究表明,将代码嵌入与审查过程特征相结合所取得的结果优于现有最先进方法。在所有任务上,F1分数(中位数为40%至62%)均显著优于现有最先进方法(提升1至9个百分点)。

英文摘要:

During code reviews, an essential step in software quality assurance, reviewers have the difficult task of understanding and evaluating code changes to validate their quality and prevent introducing faults to the codebase. This is a tedious process where the effort needed is highly dependent on the code submitted, as well as the author's and the reviewer's experience, leading to median wait times for review feedback of 15-64 hours. Through an initial user study carried with 29 experts, we found that re-ordering the files changed by a patch within the review environment has potential to improve review quality, as more comments are written (+23%), and participants' file-level hot-spot precision and recall increases to 53% (+13%) and 28% (+8%), respectively, compared to the alphanumeric ordering. Hence, this paper aims to help code reviewers by predicting which files in a submitted patch need to be (1) commented, (2) revised, or (3) are hot-spots (commented or revised). To predict these tasks, we evaluate two different types of text embeddings (i.e., Bag-of-Words and Large Language Models encoding) and review process features (i.e., code size-based and history-based features). Our empirical study on three open-source and two industrial datasets shows that combining the code embedding and review process features leads to better results than the state-of-the-art approach. For all tasks, F1-scores (median of 40-62%) are significantly better than the state-of-the-art (from +1 to +9%).

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

↑