arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1912.09652cs.SEcs.LG
收藏

CORE:代码变更的自动评审建议

CORE: Automating Review Recommendation for Code Changes

Nanyang Technology University(南洋理工大学)

JingKai Siow, Cuiyun Gao, Lingling Fan, Sen Chen, Yang Liu

摘要:

代码评审是开发人员使用的一个常见过程,其中评审者通过pull request提供有用的评论或指出提交的源代码更改中的缺陷。代码审查由于其在早期缺陷识别、项目维护和代码改进方面的能力而被广泛用于行业和开源项目。随着项目开发的快速更新,代码审查成为审查人员的一项重要且劳动密集型的任务。因此,自动化的代码审查引擎在实践中对项目开发是有益的。虽然存在通过采用静态分析工具或深度学习技术来自动化代码审查过程的先前研究,但是它们通常需要外部源,例如部分或完整的源代码以获得准确的审查建议。在本文中,我们的目标是自动化的代码审查过程中,只有基于代码的变化和相应的审查,但更好的性能。准确的代码评审建议的关键是学习代码更改和评审的良好表示。为了用有限的源实现这一点,我们设计了一个多级嵌入(即,词嵌入和字符嵌入)方法来表示代码更改和评审所提供的语义。然后通过提出的注意力深度学习模型对嵌入进行良好的训练,作为一个整体命名为CORE。我们评估了CORE对代码更改的有效性,并从Github上托管的19个流行Java项目中收集了评论。实验结果表明,我们的模型CORE可以实现比最先进的模型(DeepMem)更好的性能,在Recall@10和平均倒数排名方面分别增加了131.03%和150.69%。项目开发人员中的定性通用词分析也证明了CORE在自动化代码审查方面的性能。

英文摘要:

Code review is a common process that is used by developers, in which a reviewer provides useful comments or points out defects in the submitted source code changes via pull request. Code review has been widely used for both industry and open-source projects due to its capacity in early defect identification, project maintenance, and code improvement. With rapid updates on project developments, code review becomes a non-trivial and labor-intensive task for reviewers. Thus, an automated code review engine can be beneficial and useful for project development in practice. Although there exist prior studies on automating the code review process by adopting static analysis tools or deep learning techniques, they often require external sources such as partial or full source code for accurate review suggestion. In this paper, we aim at automating the code review process only based on code changes and the corresponding reviews but with better performance. The hinge of accurate code review suggestion is to learn good representations for both code changes and reviews. To achieve this with limited source, we design a multi-level embedding (i.e., word embedding and character embedding) approach to represent the semantics provided by code changes and reviews. The embeddings are then well trained through a proposed attentional deep learning model, as a whole named CORE. We evaluate the effectiveness of CORE on code changes and reviews collected from 19 popular Java projects hosted on Github. Experimental results show that our model CORE can achieve significantly better performance than the state-of-the-art model (DeepMem), with an increase of 131.03% in terms of Recall@10 and 150.69% in terms of Mean Reciprocal Rank. Qualitative general word analysis among project developers also demonstrates the performance of CORE in automating code review.

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

↑