当前位置: X-MOL 学术IET Softw. › 论文详情
Our official English website, www.x-mol.net, welcomes your feedback! (Note: you will need to create a separate account there.)
Constructing meaningful code changes via graph transformer
IET Software ( IF 1.6 ) Pub Date : 2023-01-21 , DOI: 10.1049/sfw2.12097
Shikai Guo 1, 2 , Mengxuan Li 1 , Xin Ge 1 , Hui Li 1 , Rong Chen 1 , Tingting Li 3
Affiliation  

The rapid development of Open-Source Software (OSS) has resulted in a significant demand for code changes to maintain OSS. Symptoms of poor design and implementation choices in code changes often occur, thus heavily hindering code reviewers to verify correctness and soundness of code changes. Researchers have investigated how to learn meaningful code changes to assist developers in anticipating changes that code reviewers may suggest for the submitted code. However, there are two main limitations to be addressed, including the limitation of long-range dependencies of the source code and the missing syntactic structural information of the source code. To solve these limitations, a novel method is proposed, named Graph Transformer for learning meaningful Code Transformations (GTCT), to provide developers with preliminary and quick feedback when developers submit code changes, which can improve the quality of code changes and improve the efficiency of code review. GTCT comprises two components: code graph embedding and code transformation learning. To address the missing syntactic structural information of the source code limitation, the code graph embedding component captures the types and patterns of code changes by encoding the source code into a code graph structure from the lexical and syntactic representations of the source code. Subsequently, the code transformation learning component uses the multi-head attention mechanism and positional encoding mechanism to address the long-range dependencies limitation. Extensive experiments are conducted to evaluate the performance of GTCT by both quantitative and qualitative analyses. For the quantitative analysis, GTCT relatively outperforms the baseline on six datasets by 210%, 342.86%, 135%, 29.41%, 109.09%, and 91.67% in terms of perfect prediction. Meanwhile, the qualitative analysis shows that each type of code change by GTCT outperforms that of the baseline method in terms of bug fixed, refactoring code and others' taxonomy of code changes.

中文翻译:

通过图形转换器构建有意义的代码更改

开源软件 (OSS) 的快速发展导致对代码更改以维护 OSS 的巨大需求。代码更改中糟糕的设计和实现选择的症状经常发生,从而严重阻碍代码审查者验证代码更改的正确性和健全性。研究人员研究了如何学习有意义的代码更改,以帮助开发人员预测代码审阅者可能对提交的代码提出的更改建议。然而,有两个主要的限制需要解决,包括源代码的远程依赖的限制和源代码的句法结构信息的缺失。为了解决这些限制,提出了一种新方法,名为 Graph Transformer for learning meaningful Code Transformations (GTCT),在开发者提交代码变更时,为开发者提供初步、快速的反馈,可以提高代码变更的质量,提高代码审查的效率。GTCT 包括两个组件:代码图嵌入和代码转换学习。为了解决源代码缺失的句法结构信息限制,代码图嵌入组件通过将源代码编码成代码图结构,从源代码的词法和句法表示中捕获代码变化的类型和模式。随后,代码转换学习组件使用多头注意机制和位置编码机制来解决远程依赖限制。进行了大量实验,通过定量和定性分析来评估 GTCT 的性能。对于定量分析,GTCT 在完美预测方面相对优于六个数据集的基线 210%、342.86%、135%、29.41%、109.09% 和 91.67%。同时,定性分析表明,GTCT 的每种代码更改在错误修复、重构代码和其他代码更改分类方面都优于基线方法。
更新日期:2023-01-21
down
wechat
bug