Comments within source code are essential for developers to comprehend the code's purpose and ensure its correct usage. However, as codebases evolve, maintaining an accurate alignment between the comments and the code becomes increasingly challenging. Recognizing the growing interest in automated solutions for detecting and correcting differences between code and its accompanying comments, current methods rely primarily on heuristic rules. In contrast, this paper presents DocChecker, a tool powered by deep learning. DocChecker is adept at identifying inconsistencies between code and comments, and it can also generate synthetic comments. This capability enables the tool to detect and correct instances where comments do not accurately reflect their corresponding code segments. We demonstrate the effectiveness of DocChecker using the Just-In-Time and CodeSearchNet datasets, benchmarking its performance against other leading methods and Large Language Models (LLMs). DocChecker is accessible for use and evaluation. It can be found on our Github https://github.com/FSoft-AI4Code/DocChecker and as an Online Tool http://4.193.50.237:5000/. For a more comprehensive understanding of its functionality, a demonstration video is available on YouTube https://youtu.be/FqnPmd531xw.
翻译:源代码中的注释对于开发者理解代码意图和确保正确使用至关重要。然而,随着代码库的不断演进,保持注释与代码之间的精确对齐变得日益困难。针对当前对自动检测和修复代码与注释差异的解决方案日益增长的需求,现有方法主要依赖启发式规则。相比之下,本文提出了一种基于深度学习的工具DocChecker。该工具擅长识别代码与注释之间的不一致性,并能够生成合成注释。这一能力使其能够检测并纠正注释未能准确反映对应代码片段的情况。我们使用Just-In-Time和CodeSearchNet数据集验证了DocChecker的有效性,并与其他主流方法及大型语言模型(LLMs)进行了性能对比。DocChecker提供公开访问和评估渠道,其代码仓库可在GitHub(https://github.com/FSoft-AI4Code/DocChecker)获取,在线工具访问地址为http://4.193.50.237:5000/。更多功能演示详见YouTube视频(https://youtu.be/FqnPmd531xw)。