注释和Source Code之间的深度即时不一致检测
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。