arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2604.27893cs.SE
收藏

对Angular应用程序中代码异味检测的实证评估

An Empirical Evaluation of Code Smell Detection in Angular Applications

Federal University of Ceará(塞阿拉联邦大学);Federal University of Bahia(巴伊亚联邦大学)

Maykon Nunes, Emanuel Coutinho, Carla Bezerra, Ivan Machado

AI总结:

本文通过灰色文献综述识别出11种Angular代码异味,其中6种也存在于React系统中,展示了自动化工具在检测代码异味中的高准确性与有效性。

摘要:

Angular是开发大规模动态网页应用最广泛采用的框架。随着项目范围和复杂性的增加,开发人员在管理架构和维护整洁模块化代码方面面临更大挑战。这些挑战往往导致设计缺陷,通常称为代码异味。虽然之前的研究已经对React特定的异味进行了分类,但关于Angular特定的异味及其表现形式的知识有限。本研究通过灰色文献综述调查Angular代码异味,汇总社区知识和技术讨论。从收集的资料中识别出11种不同的Angular代码异味,其中6种也出现在基于React的系统中,表明某些问题具有跨框架特性。每种异味都被分析、举例说明,并根据其技术特征进行分类。基于由此产生的目录,我们实现了自动化静态分析工具来检测Angular代码异味。该工具通过手动验证的数据集进行了实证评估,并通过标准信息检索指标评估其有效性。评估结果表明,所有异味的检测性能都很高,准确率值超过0.88,F1分数范围从0.89到1.00。研究结果揭示了重复性问题,如组件过载、逻辑重复和低效的模板绑定,强调了系统检测支持的相关性。本研究首次从灰色文献中整理出Angular特定的代码异味目录,并展示了自动化检测的可行性和有效性,为未来实证研究和工具开发提供了坚实的基础,旨在提高前端代码质量。

英文摘要:

Angular is one of the most widely adopted frameworks for developing large-scale, dynamic web applications. As projects increase in scope and complexity, developers face growing challenges in managing architecture and maintaining clean, modular code. These challenges often lead to design flaws, commonly referred to as code smells. While React-specific smells have been cataloged in prior studies, limited knowledge exists regarding Angular-specific smells and how they manifest. This study investigates Angular code smells through a grey literature review, consolidating community knowledge and technical discussions. From the collected sources, 11 distinct Angular code smells were identified, 6 of which also occur in React-based systems, suggesting that some issues are cross-framework. Each smell was analyzed, exemplified, and grouped according to its technical characteristics. Based on the resulting catalog, we implemented an automated static analysis tool to detect Angular code smells. The tool was empirically evaluated using a manually validated dataset, and its effectiveness was assessed through standard information retrieval metrics. The evaluation results indicate high detection performance across all smells, achieving accuracy values above 0.88 and F1-scores ranging from 0.89 to 1.00. The findings reveal recurring issues such as component overloading, duplicated logic, and inefficient template bindings, reinforcing the relevance of systematic detection support. This study presents the first catalog of Angular-specific code smells derived from grey literature and demonstrates the feasibility and effectiveness of automated detection, providing a solid foundation for future empirical studies and tool development aimed at improving front-end code quality.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑