Maykon Nunes , Carla Bezerra , Fabio Ferreira , Bruno Gois , Marco Tulio Valente
{"title":"在TypeScript应用中检测react中的代码气味","authors":"Maykon Nunes , Carla Bezerra , Fabio Ferreira , Bruno Gois , 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 , Carla Bezerra , Fabio Ferreira , Bruno Gois , 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}
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 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.