Automating Code Review Activities by Large-Scale Pre-training

Zhiyu Li, Shuai Lu, Daya Guo, Nan Duan, Shailesh Jannu +6 more
3/17/2022
333 citations
cs.SEcs.AI

Official code: microsoft/CodeBERT (2,797 stars, Python, MIT, last commit 2023-07-09).

Abstract

Code review is an essential part to software development lifecycle since it aims at guaranteeing the quality of codes. Modern code review activities necessitate developers viewing, understanding and even running the programs to assess logic, functionality, latency, style and other factors.

Show full abstract

It turns out that developers have to spend far too much time reviewing the code of their peers. Accordingly, it is in significant demand to automate the code review process. In this research, we focus on utilizing pre-training techniques for the tasks in the code review scenario. We collect a large-scale dataset of real-world code changes and code reviews from open-source projects in nine of the most popular programming languages. To better understand code diffs and reviews, we propose CodeReviewer, a pre-trained model that utilizes four pre-training tasks tailored specifically for the code review scenario. To evaluate our model, we focus on three key tasks related to code review activities, including code change quality estimation, review comment generation and code refinement. Furthermore, we establish a high-quality benchmark dataset based on our collected data for these three tasks and conduct comprehensive experiments on it. The experimental results demonstrate that our model outperforms the previous state-of-the-art pre-training approaches in all tasks. Further analysis show that our proposed pre-training tasks and the multilingual pre-training dataset benefit the model on the understanding of code changes and reviews.

View on arXivView PDF

Code Implementations(1)

microsoft/CodeBERTOfficial100%
MIT

CodeBERT

2,797499Python, ShellJun 17, 20203 years agoMIT

Similar Papers

Cite this paper

@article{li2022automating,
  title  = {Automating Code Review Activities by Large-Scale Pre-training},
  author = {Zhiyu Li and Shuai Lu and Daya Guo and Nan Duan and Shailesh Jannu and Grant Jenks and Deep Majumder and Jared Green and Alexey Svyatkovskiy and Shengyu Fu and Neel Sundaresan},
  year   = {2022},
  eprint = {2203.09095},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2203.09095}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2203.09095.svg)](https://codeofpaper.com/paper/2203.09095)

Discussion