technologies Article Enhanced Bug Prediction in JavaScript Programs with Hybrid Call-Graph Based Invocation Metrics Gábor Antal 1 , Zoltán Tóth 1 , Péter Heged ˝ us 1,2, * and Rudolf Ferenc 1   Citation: Antal, G.; Tóth, Z.; Heged ˝ us, P.; Ferenc, R. Enhanced Bug Prediction in JavaScript Programs with Hybrid Call-Graph Based Invocation Metrics. Technologies 2021, 9, 3. http://doi.org/10.3390/ technologies9010003 Received: 22 November 2020 Accepted: 23 December 2020 Published: 30 December 2020 Publisher’s Note: MDPI stays neu- tral with regard to jurisdictional clai- ms in published maps and institutio- nal affiliations. Copyright: © 2020 by the authors. Li- censee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and con- ditions of the Creative Commons At- tribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/). 1 Department of Software Engineering, University of Szeged, Dugonics tér 13., 6720 Szeged, Hungary; antal@inf.u-szeged.hu (G.A.); zizo@inf.u-szeged.hu (Z.T.); ferenc@inf.u-szeged.hu (R.F.) 2 MTA-SZTE Research Group on Artificial Intelligence, Dugonics tér 13., 6720 Szeged, Hungary * Correspondence: hpeter@inf.u-szeged.hu 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. Keywords: bug prediction; hybrid code analysis; call-graph; source code metrics 1. Introduction 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. However, practical adoption of such prediction models always depends on their real-world perfor- mance and the level of disturbing misclassification (i.e., false-positive hits) they produce. Despite the relative maturity of the bug prediction research area, the practical utilization of the state-of-the-art models is still very low due to the reasons mentioned above. Bug prediction models can use a diverse set of features to build effective prediction models. The most common types of such features are static source code metrics [14], pro- cess metrics [57], natural language features [8,9], and their combination [1012]. All these metrics proved to be useful in different contexts, but the performance of these models may vary based on, for example, the language of the project, the composition of the project team, or the domain of the software product. We need further studies to understand better how and when these models work best in certain situations. Additionally, we can refine source code metrics by using static and dynamic analysis in combination, which has a yet unknown impact on the performance of bug prediction models. 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 Technologies 2021, 9, 3. https://doi.org/10.3390/technologies9010003 https://www.mdpi.com/journal/technologies