Comments on source code serve as critical documentation for enabling developers to understand the code's functionality and use it properly. However, it is challenging to ensure that comments accurately reflect the corresponding code, particularly as the software evolves over time. Although increasing interest has been taken in developing automated methods for identifying and fixing inconsistencies between code and comments, the existing methods have primarily relied on heuristic rules. In this paper, we propose DocChecker, a deep-learning-based tool to detect the inconsistency between code and comments. DocChecker is trained to detect noisy code-comment pairs and generate synthetic comments, enabling it to determine comments that do not match their associated code snippets and correct them. Its effectiveness is demonstrated on the Just-In-Time dataset compared with other state-of-the-art methods. This tool is available at https://github.com/FSoft-AI4Code/DocChecker and http://4.193.50.237:5000/; the demonstration video can be found on https://youtu.be/KFbyaSf2I3c.
翻译:源代码注释是帮助开发者理解代码功能并正确使用代码的关键文档。然而,随着软件不断演进,确保注释能准确反映对应代码变得极具挑战性。尽管开发自动化方法以识别和修复代码与注释之间不一致性的研究日益增多,现有方法仍主要依赖启发式规则。本文提出DocChecker——一种基于深度学习的工具,用于检测代码与注释之间的不一致性。DocChecker通过训练检测含噪代码-注释对并生成合成注释,从而能够识别与对应代码片段不匹配的注释并进行修正。在Just-In-Time数据集上的实验表明,该方法相较其他最新方法具有更优效果。该工具开源地址为https://github.com/FSoft-AI4Code/DocChecker及http://4.193.50.237:5000/,演示视频详见https://youtu.be/KFbyaSf2I3c。