论文标题
评论和源代码之间的深度恰到及时的不一致检测
Deep Just-In-Time Inconsistency Detection Between Comments and Source Code
论文作者
论文摘要
自然语言评论传达了源代码的关键方面,例如实施,用法和条件前后的条件。当修改相应的代码时,无法相应地更新评论会引入不一致之处,这众所周知会导致混乱和软件错误。在本文中,我们旨在检测评论是否由于对相应的代码的变化而导致的评论是否不一致,以便在及时捕获潜在的矛盾之处,即在将其遵守代码库之前。为了实现这一目标,我们开发了一种深入学习的方法,该方法学会将评论与代码更改相关联。通过评估涵盖各种评论类型的大量评论/代码对,我们表明我们的模型的表现优于多个基线,从而大量利润率。对于外部评估,我们通过将其与评论更新模型相结合来构建更全面的自动评论维护系统,从而显示了我们的方法的有用性,该系统可以根据代码更改检测和解决不一致的注释。
Natural language comments convey key aspects of source code such as implementation, usage, and pre- and post-conditions. Failure to update comments accordingly when the corresponding code is modified introduces inconsistencies, which is known to lead to confusion and software bugs. In this paper, we aim to detect whether a comment becomes inconsistent as a result of changes to the corresponding body of code, in order to catch potential inconsistencies just-in-time, i.e., before they are committed to a code base. To achieve this, we develop a deep-learning approach that learns to correlate a comment with code changes. By evaluating on a large corpus of comment/code pairs spanning various comment types, we show that our model outperforms multiple baselines by significant margins. For extrinsic evaluation, we show the usefulness of our approach by combining it with a comment update model to build a more comprehensive automatic comment maintenance system which can both detect and resolve inconsistent comments based on code changes.