Deep Learning to Detect Redundant Method Comments

06/12/2018
by   Annie Louis, et al.
0

Comments in software are critical for maintenance and reuse. But apart from prescriptive advice, there is little practical support or quantitative understanding of what makes a comment useful. In this paper, we introduce the task of identifying comments which are uninformative about the code they are meant to document. To address this problem, we introduce the notion of comment entailment from code, high entailment indicating that a comment's natural language semantics can be inferred directly from the code. Although not all entailed comments are low quality, comments that are too easily inferred, for example, comments that restate the code, are widely discouraged by authorities on software style. Based on this, we develop a tool called CRAIC which scores method-level comments for redundancy. Highly redundant comments can then be expanded or alternately removed by the developer. CRAIC uses deep language models to exploit large software corpora without requiring expensive manual annotations of entailment. We show that CRAIC can perform the comment entailment task with good agreement with human judgements. Our findings also have implications for documentation tools. For example, we find that common tags in Javadoc are at least two times more predictable from code than non-Javadoc sentences, suggesting that Javadoc tags are less informative than more free-form comments

READ FULL TEXT

page 1

page 2

page 3

page 4

research
10/15/2018

Generating Comments From Source Code with CCGs

Good comments help developers understand software faster and provide bet...
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
03/31/2022

Comments on Comments: Where Code Review and Documentation Meet

A central function of code review is to increase understanding; helping ...
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
03/24/2021

Learning to Generate Code Comments from Class Hierarchies

Descriptive code comments are essential for supporting code comprehensio...
research
02/27/2020

Comment Ranking Diversification in Forum Discussions

Viewing consumption of discussion forums with hundreds or more comments ...
research
10/29/2019

MAT: A simple yet strong baseline for identifying self-admitted technical debt

In the process of software evolution, developers often sacrifice the lon...

Please sign up or login with your details

Forgot password? Click here to reset