The impact of context metrics on just-in-time defect prediction

Masanari Kondo, Daniel M. German, Osamu Mizuno, Eun Hye Choi

Research output: Contribution to journalArticlepeer-review

28 Citations (Scopus)


Traditional just-in-time defect prediction approaches have been using changed lines of software to predict defective-changes in software development. However, they disregard information around the changed lines. Our main hypothesis is that such information has an impact on the likelihood that the change is defective. To take advantage of this information in defect prediction, we consider n-lines (n = 1,2,…) that precede and follow the changed lines (which we call context lines), and propose metrics that measure them, which we call “Context Metrics.” Specifically, these context metrics are defined as the number of words/keywords in the context lines. In a large-scale empirical study using six open source software projects, we compare the performance of using our context metrics, traditional code churn metrics (e.g., the number of modified subsystems), our extended context metrics which measure not only context lines but also changed lines, and combination metrics that use two extended context metrics at a prediction model for defect prediction. The results show that context metrics that consider the context lines of added-lines achieve the best median value in all cases in terms of a statistical test. Moreover, using few number of context lines is suitable for context metric that considers words, and using more number of context lines is suitable for context metric that considers keywords. Finally, the combination metrics of two extended context metrics significantly outperform all studied metrics in all studied projects w. r. t. the area under the receiver operation characteristic curve (AUC) and Matthews correlation coefficient (MCC).

Original languageEnglish
Pages (from-to)890-939
Number of pages50
JournalEmpirical Software Engineering
Issue number1
Publication statusPublished - Jan 1 2020
Externally publishedYes

All Science Journal Classification (ASJC) codes

  • Software


Dive into the research topics of 'The impact of context metrics on just-in-time defect prediction'. Together they form a unique fingerprint.

Cite this