Deep Learning to Detect Redundant Method Comments

by   Annie Louis, et al.

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


page 1

page 2

page 3

page 4


Generating Comments From Source Code with CCGs

Good comments help developers understand software faster and provide bet...

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

Comments on source code serve as critical documentation for enabling dev...

Comments on Comments: Where Code Review and Documentation Meet

A central function of code review is to increase understanding; helping ...

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

Natural language comments convey key aspects of source code such as impl...

Learning to Generate Code Comments from Class Hierarchies

Descriptive code comments are essential for supporting code comprehensio...

Comment Ranking Diversification in Forum Discussions

Viewing consumption of discussion forums with hundreds or more comments ...

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