Turn Tree into Graph: Automatic Code Review via Simplified AST Driven Graph Convolutional Network

02/16/2022
by   B. Wu, et al.
0

Automatic code review (ACR), which can relieve the costs of manual inspection, is an indispensable and essential task in software engineering. To deal with ACR, existing work is to serialize the abstract syntax tree (AST). However, making sense of the whole AST with sequence encoding approach is a daunting task, mostly due to some redundant nodes in AST hinder the transmission of node information. Not to mention that the serialized representation is inadequate to grasp the information of tree structure in AST. In this paper, we first present a new large-scale Apache Automatic Code Review (AACR) dataset for ACR task since there is still no publicly available dataset in this task. The release of this dataset would push forward the research in this field. Based on it, we propose a novel Simplified AST based Graph Convolutional Network (SimAST-GCN) to deal with ACR task. Concretely, to improve the efficiency of node information dissemination, we first simplify the AST of code by deleting the redundant nodes that do not contain connection attributes, and thus deriving a Simplified AST. Then, we construct a relation graph for each code based on the Simplified AST to properly embody the relations among code fragments of the tree structure into the graph. Subsequently, in the light of the merit of graph structure, we explore a graph convolution networks architecture that follows an attention mechanism to leverage the crucial implications of code fragments to derive code representations. Finally, we exploit a simple but effective subtraction operation in the representations between the original and revised code, enabling the revised difference to be preferably learned for deciding the results of ACR. Experimental results on the AACR dataset illustrate that our proposed model outperforms the state-of-the-art methods.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
05/28/2022

Contrastive Learning for Multi-Modal Automatic Code Review

Automatic code review (ACR), aiming to relieve manual inspection costs, ...
research
11/16/2021

SStaGCN: Simplified stacking based graph convolutional networks

Graph convolutional network (GCN) is a powerful model studied broadly in...
research
07/14/2022

Golden Reference-Free Hardware Trojan Localization using Graph Convolutional Network

The globalization of the Integrated Circuit (IC) supply chain has moved ...
research
08/02/2020

Relation Extraction with Self-determined Graph Convolutional Network

Relation Extraction is a way of obtaining the semantic relationship betw...
research
02/09/2023

Vulnerability Detection with Graph Simplification and Enhanced Graph Representation Learning

Prior studies have demonstrated the effectiveness of Deep Learning (DL) ...
research
05/27/2020

Interpretable and Efficient Heterogeneous Graph Convolutional Network

Graph Convolutional Network (GCN) has achieved extraordinary success in ...
research
10/14/2022

Superpixel Perception Graph Neural Network for Intelligent Defect Detection

Aero-engine is the core component of aircraft and other spacecraft. The ...

Please sign up or login with your details

Forgot password? Click here to reset