DOI: 10.5281/zenodo.3906023
title: Defect Prediction Tool Validation Dataset 1

description: The dataset provides IaC-oriented, delta and process metrics extracted from open-source GitHub repositories based on the Ansible language, as well as the corresponding validated defect-prediction models. <strong>Context</strong> <em>Infrastructure-as-code (IaC)</em> is the DevOps strategy that allows management and provisioning of infrastructure through the definition of machine-readable files and automation around them, rather than physical hardware configuration or interactive configuration tools. On the one hand, although IaC represents an ever-increasing widely adopted practice nowadays, still little is known concerning how to best maintain, speedily evolve, and continuously improve the code behind the IaC strategy in a measurable fashion. <br> On the other hand, source code measurements are often computed and analyzed to evaluate the different quality aspects of the software developed.<br> In particular, Infrastructure-as-Code is simply "code", as such it is prone to defects as any other programming languages. This dataset targets the YAML-based Ansible language to devise **defects prediction** approaches for IaC based on Machine-learning. <strong>Content</strong> The dataset contains metrics extracted from 85 open-source GitHub repositories based on the Ansible language that satisfied the following criteria: * The repository has at least one push event to its master branch in the last six months;<br> * The repository has at least 2 releases;<br> * At least 11% of the files in the repository are IaC scripts;<br> * The repository has at least 2 core contributors;<br> * The repository has evidence of continuous integration practice, such as the presence of a .travis.yaml file;<br> * The repository has a comments ratio of at least 0.2%;<br> * The repository has commit frequency of at least 2 per month on average;<br> * The repository has an issue frequency of at least 0.023 events per month on average;<br> * The repository has evidence of a license, such as the presence of a LICENSE.md file<br> * The repository has at least 190 source lines of code. Metrics are grouped into three categories: * <strong>IaC-oriented:</strong> metrics of structural properties derived from the source code of infrastructure scripts; * <strong>Delta</strong>: metrics that capture the amount of change in a file between two successive releases, collected for each IaC-oriented metric; * <strong>Process</strong>: metrics that capture aspects of the development process rather than aspects about the code itself. Description of the process metrics in this dataset can be found [here](https://pydriller.readthedocs.io/en/latest/processmetrics.html). In addition to the metrics, the dataset contains the pre-trained models (one per repositories) in the folder models.zip. The folder contains the following two files for each repository; * a pickle file containing the pre-trained model. It has the following naming convention: &lt;repoowner__reponame&gt;.pkl <br> To load the model in python use the following: ```<br> from joblib import load<br> model = load('path/to/the/pickle/file.pkl'), mmap_mode='r')<br> ``` * a son file containing the attributes used to train the model. Those attributed are needed to use the corresponding model correctly. It has the following naming convention: &lt;repoowner__reponame&gt;.json. To use the model after loading it as described above, use:<br> ```<br> import json<br> with open('path/to/the/pickle/file.json'), 'r') as in_file:<br> model_features = json.load(in_file)<br> ``` You can then collect and pass those features to the model for the final prediction. <strong>Acknowledgements</strong> Thanks to the open-source community :) <br> <strong>Inspiration</strong> What source code properties and properties about the development process are good predictors of defects in Infrastructure-as-Code scripts? <strong>Note</strong> Further information about the dataset and the validation results can be found at: https://github.com/stefanodallapalma/Defect-Prediction-IaC-TSE2020-replication-package