一句话:用预训练 T5 模型自动完成代码审查任务,并在更大更真实数据集上超越此前深度学习模型。
代码审查成本高,已有研究尝试自动化,其中两个深度学习模型分别根据待审代码生成审查者可能建议的修改,以及根据代码与自然语言评论自动落实修改。但先前模型与实验针对较简单场景,问题被简化。本文在此基础上采用预训练 Text-To-Text Transfer Transformer (T5) 模型,面向上述代码审查自动化任务进行建模与实验,并在规模更大、更接近真实且更具挑战性的代码审查活动数据集上评估。结果表明,预训练 T5 能优于此前的深度学习模型,说明预训练文本到文本模型可提升代码审查自动化效果,并为后续复杂真实场景研究提供依据。
Code review is a practice widely adopted in open source and industrial projects. Given the non-negligible cost of such a process, researchers started investigating the possibility of automating specific code review tasks. We recently proposed Deep Learning (DL) models targeting the automation of two tasks: the first model takes as input a code submitted for review and implements in it changes likely to be recommended by a reviewer; the second takes as input the submitted code and a reviewer comment posted in natural language and automatically implements the change required by the reviewer. While the preliminary results we achieved are encouraging, both models had been tested in rather simple code review scenarios, substantially simplifying the targeted problem. This was also due to the choices we made when designing both the technique and the experiments. In this paper, we build on top of that work by demonstrating that a pre-trained Text-To-Text Transfer Transformer (T5) model can outperform previous DL models for automating code review tasks. Also, we conducted our experiments on a larger and more realistic (and challenging) dataset of code review activities.
DOI 原文 · arXiv · PDF(开放获取) · DBLP
@inproceedings{abs-2201-06850,
title = {Using pre-trained models to boost code review automation},
author = {Rosalia Tufano and Simone Masiero and Antonio Mastropaolo and Luca Pascarella and Denys Poshyvanyk and Gabriele Bavota},
booktitle = {ICSE},
year = {2022},
doi = {10.1145/3510003.3510621}
}