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

利用基于混合调用图的调用度量增强 JavaScript 程序缺陷预测

Enhanced Bug Prediction in JavaScript Programs with Hybrid Call-Graph Based Invocation Metrics

Gábor Antal, Zoltán Tóth, Péter Hegedűs, Rudolf Ferenc

AI总结:

针对 JavaScript 静态分析不精确导致函数级缺陷预测受限的问题,提出融合静态特征与混合调用图 HNII/HNOI 度量的模型,并在 BugsJS 的 ESLint 数据上验证性能提升 2–10%。

摘要:

缺陷预测旨在发现软件系统中可能包含缺陷的源代码元素。在了解程序中最易出错的部分后,人们可以高效分配有限的测试和代码审查资源。因此,缺陷预测能够在很大程度上支持软件维护与演化。本文提出一种函数级 JavaScript 缺陷预测模型,该模型基于静态源代码度量,并加入了一种基于混合(静态和动态)代码分析的入向与出向函数调用数量度量(HNII 和 HNOI)。我们的动机是,JavaScript 是一种高度动态的脚本语言,对其进行静态代码分析可能非常不精确;因此,仅使用纯静态源代码特征进行缺陷预测可能并不足够。在一项研究中,我们从公开可用的 BugsJS 数据集中为 ESLint JavaScript 项目提取了 824 个有缺陷函数和 1943 个无缺陷函数;基于该研究,我们可以确认混合代码度量对机器学习模型预测性能的积极影响。根据所采用的机器学习算法、应用的超参数以及所考虑的目标指标,混合调用度量使模型性能(即精确率、召回率、F-measure)提升 2–10%。有趣的是,仅将静态 NOI 和 NII 度量替换为对应的混合版本 HNOI 和 HNII,本身就能够提升模型性能;然而,将它们全部结合使用会取得最佳结果。

英文摘要:

Bug prediction aims at finding source code elements in a software system that are likely to contain defects. Being aware of the most error-prone parts of the program, one can efficiently allocate the limited amount of testing and code review resources. Therefore, bug prediction can support software maintenance and evolution to a great extent. In this paper, we propose a function level JavaScript bug prediction model based on static source code metrics with the addition of a hybrid (static and dynamic) code analysis based metric of the number of incoming and outgoing function calls (HNII and HNOI). Our motivation for this is that JavaScript is a highly dynamic scripting language for which static code analysis might be very imprecise; therefore, using a purely static source code features for bug prediction might not be enough. Based on a study where we extracted 824 buggy and 1943 non-buggy functions from the publicly available BugsJS dataset for the ESLint JavaScript project, we can confirm the positive impact of hybrid code metrics on the prediction performance of the ML models. Depending on the ML algorithm, applied hyper-parameters, and target measures we consider, hybrid invocation metrics bring a 2-10% increase in model performances (i.e., precision, recall, F-measure). Interestingly, replacing static NOI and NII metrics with their hybrid counterparts HNOI and HNII in itself improves model performances; however, using them all together yields the best results.

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

↑