$^{\prime}\mathbf{R}$: Towards Detecting and Understanding Code-Document Violations in Rust

Wanrong Ouyang, Baojian Hua
{"title":"$^{\\prime}\\mathbf{R}$: Towards Detecting and Understanding Code-Document Violations in Rust","authors":"Wanrong Ouyang, Baojian Hua","doi":"10.1109/ISSREW53611.2021.00063","DOIUrl":null,"url":null,"abstract":"Documentation and comments are important for any software project. Although documentation is not executed, it is useful for many purposes, such as code comprehension, reuse, and maintenance. As a project evolves, the code and documentation can easily grow out-of-sync, and inconsistencies are introduced, which can mislead developers and introduce new bugs in subsequent developments. Recent studies have shown it is promising to use natural language processing and machine learning to detect inconsistencies between code and documentation. However, it's challenging to apply existing techniques to detect code-document inconsistency in Rust programs, as Rustdoc supports advanced document features like document testing, which makes existing solutions inapplicable. This paper presents the first software tool prototype, 'R, to detect and understand code-document inconsistencies in Rust. To perform such analysis, 'R leverages static program analysis, not only on Rust source code, but also on document testing code, to detect inconsistency indicating either bugs or bad documentation. To evaluate the effectiveness of 'R, we applied it to 37 open source Rust projects from 9 domains, with a total of 6,192,251 lines of Rust source code (with 322,330 lines of comments). The results of the analysis give interesting insights, for example: the cryptocurrency domain has the highest documentation ratio (58.23%), documentation testing is rarely used (ratio 2.30% on average) in real-world Rust projects in all domains, etc. Based on these findings, we propose recommendations to guide the construction of better Rust documentation, better Rust documentation quality detection tools, and boarder adoption of the language.","PeriodicalId":385392,"journal":{"name":"2021 IEEE International Symposium on Software Reliability Engineering Workshops (ISSREW)","volume":"466 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2021-10-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"2021 IEEE International Symposium on Software Reliability Engineering Workshops (ISSREW)","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1109/ISSREW53611.2021.00063","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0

Abstract

Documentation and comments are important for any software project. Although documentation is not executed, it is useful for many purposes, such as code comprehension, reuse, and maintenance. As a project evolves, the code and documentation can easily grow out-of-sync, and inconsistencies are introduced, which can mislead developers and introduce new bugs in subsequent developments. Recent studies have shown it is promising to use natural language processing and machine learning to detect inconsistencies between code and documentation. However, it's challenging to apply existing techniques to detect code-document inconsistency in Rust programs, as Rustdoc supports advanced document features like document testing, which makes existing solutions inapplicable. This paper presents the first software tool prototype, 'R, to detect and understand code-document inconsistencies in Rust. To perform such analysis, 'R leverages static program analysis, not only on Rust source code, but also on document testing code, to detect inconsistency indicating either bugs or bad documentation. To evaluate the effectiveness of 'R, we applied it to 37 open source Rust projects from 9 domains, with a total of 6,192,251 lines of Rust source code (with 322,330 lines of comments). The results of the analysis give interesting insights, for example: the cryptocurrency domain has the highest documentation ratio (58.23%), documentation testing is rarely used (ratio 2.30% on average) in real-world Rust projects in all domains, etc. Based on these findings, we propose recommendations to guide the construction of better Rust documentation, better Rust documentation quality detection tools, and boarder adoption of the language.
查看原文
分享 分享
微信好友 朋友圈 QQ好友 复制链接
本刊更多论文
$^{\prime}\mathbf{R}$:在Rust中检测和理解代码文档冲突
文档和注释对任何软件项目都很重要。虽然没有执行文档,但它对于许多目的都很有用,例如代码理解、重用和维护。随着项目的发展,代码和文档很容易变得不同步,并引入不一致,这可能会误导开发人员并在后续开发中引入新的错误。最近的研究表明,使用自然语言处理和机器学习来检测代码和文档之间的不一致是有希望的。然而,应用现有的技术来检测Rust程序中的代码-文档不一致是一项挑战,因为Rustdoc支持文档测试等高级文档特性,这使得现有的解决方案不适用。本文提出了第一个软件工具原型,'R,用于检测和理解Rust中的代码-文档不一致。为了执行这样的分析,R利用静态程序分析,不仅在Rust源代码上,而且在文档测试代码上,检测指示错误或错误文档的不一致。为了评估R的有效性,我们将其应用于来自9个领域的37个开源Rust项目,总共有6,192,251行Rust源代码(322,330行注释)。分析的结果给出了有趣的见解,例如:加密货币领域的文档比例最高(58.23%),文档测试在所有领域的真实Rust项目中很少使用(平均比例为2.30%),等等。基于这些发现,我们提出了一些建议,以指导构建更好的Rust文档,更好的Rust文档质量检测工具,以及更广泛地采用该语言。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 去求助
来源期刊
自引率
0.00%
发文量
0
期刊最新文献
An efficient dual ensemble software defect prediction method with neural network Genetic Algorithm-based Testing of Industrial Elevators under Passenger Uncertainty Predicting gray fault based on context graph in container-based cloud Aging and Rejuvenation Models of Load Changing Attacks in Micro-Grids Sensitivity Analysis of Software Rejuvenation Model with Markov Regenerative Process
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
现在去查看 取消
×
提示
确定
0
微信
客服QQ
Book学术公众号 扫码关注我们
反馈
×
意见反馈
请填写您的意见或建议
请填写您的手机或邮箱
已复制链接
已复制链接
快去分享给好友吧!
我知道了
×
扫码分享
扫码分享
Book学术官方微信
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术
文献互助 智能选刊 最新文献 互助须知 联系我们:info@booksci.cn
Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。
Copyright © 2023 Book学术 All rights reserved.
ghs 京公网安备 11010802042870号 京ICP备2023020795号-1