Skip to content

Python package to predict bugs using the complexity of code changes

License

Notifications You must be signed in to change notification settings

HaaLeo/bug-prediction

Repository files navigation

bugprediction

Stars
Build Status Codecov PRs Welcome
Donate

Description

This repository enables you to calculate the history complexity metric Ahmed E. Hassan introduced at the 2009 IEEE 31st International Conference on Software Engineering in May 2009 (DOI: 10.1109/ICSE.2009.5070510) and use it for the prediction of the amount of bugs. The implementation was part of the course Software Qualität at the Technical University of Munich in summer 2019.
The training data set was derived from the data set that Marco D'Ambros, Michele Lanza and Romain Robbes used in their paper An Extensive Comparison of Bug Prediction Approaches. The original data set is available at http://bug.inf.usi.ch/index.php.

Installation

From Source

git clone git@github.com:HaaLeo/bug-prediction.git
cd bug-prediction

pipenv install
pipenv shell

python -m bugprediction --version

Usage

To print all available options:

python -m bugprediction --help

Training is currently only possible from source. To do so run the edit the train.py to your needs and run it.

API

In order to use the API you need to bundle and install the package:

python setup.py sdist bdist_wheel
pip install dist/bugprediction-0.0.1.tar.gz

Then you can use tha API like shown bellow:

from bugprediction import calculate_hcm, predict

history_complexity_metric, _ = calculate_hcm(**kwargs)
prediction_map = predict(hcm_map, **args)

Contribution

If you found a bug or are missing a feature do not hesitate to file an issue.
Pull Requests are welcome!

Support

When you like this package make sure to star the repository. I am always looking for new ideas and feedback.
In addition, it is possible to donate via paypal.