HatCUP: Hybrid Analysis and Attention based Just-In-Time Comment Updating

05/02/2022
by   Hongquan Zhu, et al.
0

When changing code, developers sometimes neglect updating the related comments, bringing inconsistent or outdated comments. These comments increase the cost of program understanding and greatly reduce software maintainability. Researchers have put forward some solutions, such as CUP and HEBCUP, which update comments efficiently for simple code changes (i.e. modifying of a single token), but not good enough for complex ones. In this paper, we propose an approach, named HatCUP (Hybrid Analysis and Attention based Comment UPdater), to provide a new mechanism for comment updating task. HatCUP pays attention to hybrid analysis and information. First, HatCUP considers the code structure change information and introduces a structure-guided attention mechanism combined with code change graph analysis and optimistic data flow dependency analysis. With a generally popular RNN-based encoder-decoder architecture, HatCUP takes the action of the code edits, the syntax, semantics and structure code changes, and old comments as inputs and generates a structural representation of the changes in the current code snippet. Furthermore, instead of directly generating new comments, HatCUP proposes a new edit or non-edit mechanism to mimic human editing behavior, by generating a sequence of edit actions and constructing a modified RNN model to integrate newly developed components. Evaluation on a popular dataset demonstrates that HatCUP outperforms the state-of-the-art deep learning-based approaches (CUP) by 53.8 for accuracy, 31.3 Compared with the heuristic-based approach (HEBCUP), HatCUP also shows better overall performance.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
10/04/2020

Deep Just-In-Time Inconsistency Detection Between Comments and Source Code

Natural language comments convey key aspects of source code such as impl...
research
08/14/2023

CupCleaner: A Data Cleaning Approach for Comment Updating

Recently, deep learning-based techniques have shown promising performanc...
research
10/16/2018

An analysis of Principle 1.2 in the new ACM Code Of Ethics

The new ACM Code of Ethics is a much-needed update, but introduced chang...
research
05/28/2017

Deep Learning for User Comment Moderation

Experimenting with a new dataset of 1.6M user comments from a Greek news...
research
06/10/2023

Bootstrapping Code-Text Pretrained Language Model to Detect Inconsistency Between Code and Comment

Comments on source code serve as critical documentation for enabling dev...
research
08/21/2018

Automatic Generation of Text Descriptive Comments for Code Blocks

We propose a framework to automatically generate descriptive comments fo...
research
01/25/2022

Attention-Based Vandalism Detection in OpenStreetMap

OpenStreetMap (OSM), a collaborative, crowdsourced Web map, is a unique ...

Please sign up or login with your details

Forgot password? Click here to reset