一句话:提出 AUGER,基于 T5 预训练模型从代码变更自动生成审查评论,ROUGE-L 较基线提升 37.38%。
代码审查是保障软件质量的重要实践,但人工撰写有用评论耗时巨大,且个人知识有限,审查效率与效果有待提升。本文提出 AUGER(AUtomatically GEnerating Review comments),一个基于预训练模型的审查评论生成器。作者首先从 11 个知名 Java 项目中收集经验性审查数据,构建了包含 10,882 条代码变更的数据集;然后利用 Text-to-Text Transfer Transformer(T5)模型在训练阶段合成有价值的审查知识,实现从代码变更自动生成评论。评估显示,AUGER 在 ROUGE-L 上较基线提升 37.38%,29% 的自动评论被判定为有用,推理仅需 20 秒且支持继续训练;案例研究进一步表明其性能可继续改善。
Code review is one of the best practices as a powerful safeguard for software quality. In practice, senior or highly skilled reviewers inspect source code and provide constructive comments, consider- ing what authors may ignore, for example, some special cases. The collaborative validation between contributors results in code being highly qualified and less chance of bugs. However, since personal knowledge is limited and varies, the efficiency and effectiveness of code review practice are worthy of further improvement. In fact, it still takes a colossal and time-consuming effort to deliver useful review comments. This paper explores a synergy of multiple practical review comments to enhance code review and proposes AUGER (AUtomatically GEnerating Review comments): a review comments generator with pre-training models. We first collect empirical review data from 11 notable Java projects and construct a dataset of 10,882 code changes. By leveraging Text-to-Text Transfer Transformer (T5) models, the framework synthesizes valuable knowledge in the training stage and effectively outperforms baselines by 37.38% in ROUGE-L. 29% of our automatic review comments are considered useful according to prior studies. The inference generates just in 20 seconds and is also open to training further. Moreover, the performance also gets improved when thoroughly analyzed in case study.
@inproceedings{paperbot7103,
title = {AUGER: automatically generating review comments with pre-training models},
author = {Lingwei Li and Li Yang and Huaxi Jiang and Jun Yan and Tiejian Luo and Zihan Hua and Geng Liang and Chun Zuo},
booktitle = {FSE},
year = {2022},
doi = {10.1145/3540250.3549099}
}