Table of Contents
Fetching ...

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

TL;DR

This work tackles bug prediction in JavaScript by augmenting static source-code metrics with hybrid invocation metrics derived from a hybrid call-graph that blends static and dynamic analysis. The authors implement a hcg-js-framework to compute $HNII$ and $HNOI$, and evaluate these features on a BugsJS/ESLint dataset of 824 buggy and 1943 non-buggy functions across nine ML algorithms and 108 configurations. They show consistent improvements of 2–10% in precision, recall, and F-measure when including $HNII$/$HNOI$, with the best results achieved when static NOI/NII are kept alongside their hybrid counterparts. The findings indicate that hybrid metrics provide complementary information that enhances bug prediction in JavaScript, guiding model choice toward Random Forest for overall accuracy or KNN for balanced performance, and they underscore the value of combining static and dynamic analyses for dynamic languages.

Abstract

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.

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

TL;DR

This work tackles bug prediction in JavaScript by augmenting static source-code metrics with hybrid invocation metrics derived from a hybrid call-graph that blends static and dynamic analysis. The authors implement a hcg-js-framework to compute and , and evaluate these features on a BugsJS/ESLint dataset of 824 buggy and 1943 non-buggy functions across nine ML algorithms and 108 configurations. They show consistent improvements of 2–10% in precision, recall, and F-measure when including /, with the best results achieved when static NOI/NII are kept alongside their hybrid counterparts. The findings indicate that hybrid metrics provide complementary information that enhances bug prediction in JavaScript, guiding model choice toward Random Forest for overall accuracy or KNN for balanced performance, and they underscore the value of combining static and dynamic analyses for dynamic languages.

Abstract

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.
Paper Structure (14 sections, 3 equations, 14 figures, 3 tables)

This paper contains 14 sections, 3 equations, 14 figures, 3 tables.

Figures (14)

  • Figure S1: Applied Toolchain
  • Figure S2: Hybrid call-graph framework architecture
  • Figure S3: Venn diagram of found edges
  • Figure S4: Top 10 recall measures
  • Figure S5: Deep neural network
  • ...and 9 more figures