Skip to content
Bugspots is a Python implementation of the Google's bug prediction algorithm.
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


What is bugspots?

Bugspots is a Python implementation of the bug prediction algorithm used at Google. It also embed a command-line interface which can be used to list the "hot spots" of a Git repository.

What is a hot spot?

A hot spot is merely a file that is bug-prone.

How does it work?

The algorithm is very simple and to the point: it gives each file a score based on its number of bug-fixing commits and their age, and then return a descending-ordered list of the files based on their score, filtering commits that are no longer at HEAD.

What is a bug-fixing commit?

Any commit whose purpose is to fix an issue. They are identified by message, using the same pattern as GitHub, which is:

(?i)(fix(e[sd])?|close[sd]?) #[1-9][0-9]*

What is the formula used?


where ti is the timestamp of the ith commit, normalized between 0 and 1 (0 being the date of the first commit in the repository and 1 being the date of the last commit in the repository), and n is the number of bug-fixing commits.


$ pip install bugspots

Command-line usage

$ -h

Python example

import bugspots
b = bugspots.Bugspots()
for hotspot in b.get_hotspots():
    print " %6.3f %s" % (hotspot.score, hotspot.filename)
Something went wrong with that request. Please try again.