paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Towards Automating Code Review Activities

迈向代码评审活动的自动化
ICSE 2021 IEEE/ACM 43rd International Conference on Software Engineering (ICSE)2021匹配度 2/10 · 该论文研究用深度学习自动化代码评审中的代码变换与评论实现,属于机器学习与软件工程/开发者工具交叉,但未涉及静态分析、形式化验证、Agentic 程序、浮点或贝叶斯程序分析等用户核心方向。其方法基于传统深度学习而非当前 LLM/Agent,且目标不是提升静态分析或形式化验证。引用 212 inbox
Rosalia Tufano, Luca Pascarella, Michele Tufano, Denys Poshyvanyk, Gabriele Bavota
crossref: 2026-09-12dblp: 2026-09-12arxiv: 2026-09-12

AI 速览

一句话:训练两个深度学习模型分别自动化代码评审的贡献者端与评审者端:提交前自动施加评审式代码变换,并按自然语言评论改写代码。

代码评审在工业界与开源项目中广泛使用,能提升代码质量、降低引入缺陷的概率,但作为一种人工活动,它需要开发者花费大量时间审阅同伴的代码。本文迈出部分自动化代码评审的第一步,从贡献者与评审者两个角度分别训练深度学习模型:第一个模型学习开发者在真实评审活动中所做的代码修改,从而在代码提交评审之前就向贡献者给出融入评审常见变换的修订版本;第二个模型接收评审者用自然语言写下的评论,自动生成实现该评论的修订代码。实证评估显示,贡献者端模型最多在 16% 的情况下能复现评审中实际应用的代码变换,评审者端模型最多在 31% 的情况下能正确实现自然语言评论。作者认为这些结果令人鼓舞,但要让模型真正为开发者所用仍需更多研究。

问题
代码评审完全依赖人工,占用开发者大量时间;本文关注如何部分自动化评审流程中贡献者端的代码修订与评审者端的评论落实。
方法
分别训练两个深度学习架构:一个从真实代码评审中学习开发者所做的代码修改,用于在提交前生成修订代码;另一个根据自然语言评论自动改写被评审的代码。
评估
在真实代码评审数据上进行实证评估:贡献者端模型最多在 16% 的情形下复现评审中实际应用的代码变换,评审者端模型最多在 31% 的情形下正确实现自然语言评论。
原文摘要(Abstract)

Code reviews are popular in both industrial and open source projects. The benefits of code reviews are widely recognized and include better code quality and lower likelihood of introducing bugs. However, since code review is a manual activity it comes at the cost of spending developers' time on reviewing their teammates' code. Our goal is to make the first step towards partially automating the code review process, thus, possibly reducing the manual costs associated with it. We focus on both the contributor and the reviewer sides of the process, by training two different Deep Learning architectures. The first one learns code changes performed by developers during real code review activities, thus providing the contributor with a revised version of her code implementing code transformations usually recommended during code review before the code is even submitted for review. The second one automatically provides the reviewer commenting on a submitted code with the revised code implementing her comments expressed in natural language. The empirical evaluation of the two models shows that, on the contributor side, the trained model succeeds in replicating the code transformations applied during code reviews in up to 16% of cases. On the reviewer side, the model can correctly implement a comment provided in natural language in up to 31% of cases. While these results are encouraging, more research is needed to make these models usable by developers.

链接与引用

DOI 原文 · arXiv · PDF(开放获取) · DBLP

BibTeX
@inproceedings{abs-2101-02518,
  title = {Towards Automating Code Review Activities},
  author = {Rosalia Tufano and Luca Pascarella and Michele Tufano and Denys Poshyvanyk and Gabriele Bavota},
  booktitle = {ICSE},
  year = {2021},
  doi = {10.1109/icse43902.2021.00027}
}