在TypeScript应用中检测react中的代码气味

IF 4.3 2区 计算机科学 Q2 COMPUTER SCIENCE, INFORMATION SYSTEMS
Maykon Nunes , Carla Bezerra , Fabio Ferreira , Bruno Gois , Marco Tulio Valente
{"title":"在TypeScript应用中检测react中的代码气味","authors":"Maykon Nunes ,&nbsp;Carla Bezerra ,&nbsp;Fabio Ferreira ,&nbsp;Bruno Gois ,&nbsp;Marco Tulio Valente","doi":"10.1016/j.infsof.2025.107835","DOIUrl":null,"url":null,"abstract":"<div><h3>Context:</h3><div>In the last few years, <span>React</span> has become a popular library for building web interfaces, and more recently, developers have started using it with TypeScript, a language that adds static typing to JavaScript. Although code smells have been explored in several works, there are few studies that focus on the quality problems specific to web interfaces built using <span>React</span> and this language.</div></div><div><h3>Objective:</h3><div>This work aims to identify common code smells in this context, assess how developers perceive their impact, propose a tool to detect them, evaluate the tool’s performance and usability, and analyze the prevalence of these smells in open-source projects.</div></div><div><h3>Method:</h3><div>We conducted a gray literature review to identify code smells, followed by interviews and a community survey to validate them. We developed the tool <span>SniffTSX</span> by extending <span>ReactSniffer</span> to detect the smells. To evaluate the tool, we built a dataset with labeled instances and measured its detection performance using standard metrics. We also carried out a TAM-based user study with undergraduate computing students.</div></div><div><h3>Results:</h3><div>We identified six relevant smells. According to developers’ perception, the most critical and frequent ones are <span>Any Type</span>, <span>Multiple Booleans for State</span>, and <span>Non-Null Assertions</span>. The tool achieved high performance (accuracy: 0.96, precision: 0.98, recall: 0.93, F1: 0.95). The user study showed positive perceptions of usefulness and ease of use. The empirical analysis confirmed the widespread presence of the smells, particularly <span>Any Type</span> and <span>Non-Null Assertions</span>, in real-world projects. Our evaluation results show that <span>SniffTSX</span> is useful.</div></div><div><h3>Conclusion:</h3><div>We contribute a catalog of <span>React</span>-specific TypeScript code smells and a tool to detect them. The tool proved accurate, well-received by students, and effective in revealing real-world smell prevalence, supporting developers in improving code quality.</div></div>","PeriodicalId":54983,"journal":{"name":"Information and Software Technology","volume":"187 ","pages":"Article 107835"},"PeriodicalIF":4.3000,"publicationDate":"2025-07-19","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":"{\"title\":\"Detection of code smells in react with TypeScript applications\",\"authors\":\"Maykon Nunes ,&nbsp;Carla Bezerra ,&nbsp;Fabio Ferreira ,&nbsp;Bruno Gois ,&nbsp;Marco Tulio Valente\",\"doi\":\"10.1016/j.infsof.2025.107835\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"<div><h3>Context:</h3><div>In the last few years, <span>React</span> has become a popular library for building web interfaces, and more recently, developers have started using it with TypeScript, a language that adds static typing to JavaScript. Although code smells have been explored in several works, there are few studies that focus on the quality problems specific to web interfaces built using <span>React</span> and this language.</div></div><div><h3>Objective:</h3><div>This work aims to identify common code smells in this context, assess how developers perceive their impact, propose a tool to detect them, evaluate the tool’s performance and usability, and analyze the prevalence of these smells in open-source projects.</div></div><div><h3>Method:</h3><div>We conducted a gray literature review to identify code smells, followed by interviews and a community survey to validate them. We developed the tool <span>SniffTSX</span> by extending <span>ReactSniffer</span> to detect the smells. To evaluate the tool, we built a dataset with labeled instances and measured its detection performance using standard metrics. We also carried out a TAM-based user study with undergraduate computing students.</div></div><div><h3>Results:</h3><div>We identified six relevant smells. According to developers’ perception, the most critical and frequent ones are <span>Any Type</span>, <span>Multiple Booleans for State</span>, and <span>Non-Null Assertions</span>. The tool achieved high performance (accuracy: 0.96, precision: 0.98, recall: 0.93, F1: 0.95). The user study showed positive perceptions of usefulness and ease of use. The empirical analysis confirmed the widespread presence of the smells, particularly <span>Any Type</span> and <span>Non-Null Assertions</span>, in real-world projects. Our evaluation results show that <span>SniffTSX</span> is useful.</div></div><div><h3>Conclusion:</h3><div>We contribute a catalog of <span>React</span>-specific TypeScript code smells and a tool to detect them. The tool proved accurate, well-received by students, and effective in revealing real-world smell prevalence, supporting developers in improving code quality.</div></div>\",\"PeriodicalId\":54983,\"journal\":{\"name\":\"Information and Software Technology\",\"volume\":\"187 \",\"pages\":\"Article 107835\"},\"PeriodicalIF\":4.3000,\"publicationDate\":\"2025-07-19\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"0\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"Information and Software Technology\",\"FirstCategoryId\":\"94\",\"ListUrlMain\":\"https://www.sciencedirect.com/science/article/pii/S0950584925001740\",\"RegionNum\":2,\"RegionCategory\":\"计算机科学\",\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"Q2\",\"JCRName\":\"COMPUTER SCIENCE, INFORMATION SYSTEMS\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"Information and Software Technology","FirstCategoryId":"94","ListUrlMain":"https://www.sciencedirect.com/science/article/pii/S0950584925001740","RegionNum":2,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q2","JCRName":"COMPUTER SCIENCE, INFORMATION SYSTEMS","Score":null,"Total":0}
引用次数: 0

摘要

背景:在过去的几年里,React已经成为一个流行的构建web界面的库,最近,开发人员开始将它与TypeScript一起使用,TypeScript是一种为JavaScript添加静态类型的语言。虽然代码气味已经在一些作品中进行了探索,但很少有研究关注使用React和该语言构建的web界面的质量问题。目的:本工作旨在识别这种情况下常见的代码气味,评估开发人员如何感知其影响,提出一种工具来检测它们,评估工具的性能和可用性,并分析这些气味在开源项目中的流行程度。方法:我们进行了灰色文献回顾来识别代码气味,随后进行访谈和社区调查来验证它们。我们通过扩展ReactSniffer来开发SniffTSX工具来检测气味。为了评估该工具,我们构建了一个带有标记实例的数据集,并使用标准指标测量其检测性能。我们还对计算机专业的本科生进行了基于tam的用户研究。结果:我们确定了六种相关气味。根据开发人员的看法,最关键和最常见的是任意类型、多布尔状态和非空断言。该工具取得了很高的性能(准确度:0.96,精密度:0.98,召回率:0.93,F1: 0.95)。用户研究显示了对有用性和易用性的积极看法。实证分析证实了在实际项目中气味的广泛存在,特别是任何类型和非空断言。我们的评估结果表明SniffTSX是有用的。总结:我们提供了一个特定于react的TypeScript代码气味目录和一个检测它们的工具。该工具被证明是准确的,深受学生的欢迎,并且在揭示真实世界的气味流行方面是有效的,支持开发人员改进代码质量。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
Detection of code smells in react with TypeScript applications

Context:

In the last few years, React has become a popular library for building web interfaces, and more recently, developers have started using it with TypeScript, a language that adds static typing to JavaScript. Although code smells have been explored in several works, there are few studies that focus on the quality problems specific to web interfaces built using React and this language.

Objective:

This work aims to identify common code smells in this context, assess how developers perceive their impact, propose a tool to detect them, evaluate the tool’s performance and usability, and analyze the prevalence of these smells in open-source projects.

Method:

We conducted a gray literature review to identify code smells, followed by interviews and a community survey to validate them. We developed the tool SniffTSX by extending ReactSniffer to detect the smells. To evaluate the tool, we built a dataset with labeled instances and measured its detection performance using standard metrics. We also carried out a TAM-based user study with undergraduate computing students.

Results:

We identified six relevant smells. According to developers’ perception, the most critical and frequent ones are Any Type, Multiple Booleans for State, and Non-Null Assertions. The tool achieved high performance (accuracy: 0.96, precision: 0.98, recall: 0.93, F1: 0.95). The user study showed positive perceptions of usefulness and ease of use. The empirical analysis confirmed the widespread presence of the smells, particularly Any Type and Non-Null Assertions, in real-world projects. Our evaluation results show that SniffTSX is useful.

Conclusion:

We contribute a catalog of React-specific TypeScript code smells and a tool to detect them. The tool proved accurate, well-received by students, and effective in revealing real-world smell prevalence, supporting developers in improving code quality.
求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
Information and Software Technology
Information and Software Technology 工程技术-计算机:软件工程
CiteScore
9.10
自引率
7.70%
发文量
164
审稿时长
9.6 weeks
期刊介绍: Information and Software Technology is the international archival journal focusing on research and experience that contributes to the improvement of software development practices. The journal''s scope includes methods and techniques to better engineer software and manage its development. Articles submitted for review should have a clear component of software engineering or address ways to improve the engineering and management of software development. Areas covered by the journal include: • Software management, quality and metrics, • Software processes, • Software architecture, modelling, specification, design and programming • Functional and non-functional software requirements • Software testing and verification & validation • Empirical studies of all aspects of engineering and managing software development Short Communications is a new section dedicated to short papers addressing new ideas, controversial opinions, "Negative" results and much more. Read the Guide for authors for more information. The journal encourages and welcomes submissions of systematic literature studies (reviews and maps) within the scope of the journal. Information and Software Technology is the premiere outlet for systematic literature studies in software engineering.
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术官方微信