Predicting Bugs in your Code
Linespots is a modified version of Google's Bugspots algorithm and uses the git history of a project to predict bugs. While Bugspots proposes whole files as bug prone, Linespots serves single lines and thus allows for a more detailed inspection.
Code review is an important aspect of modern software development but time-consuming.
In 2011, Google proposed the Bugspots algorithm to help reviewers to focus on files that
are more bug prone.
The Bugspots algorithm ranks all files in a project by their relative probability of containing bugs. The idea is for reviewers to focus on these files if there is not enough time to review everything, or review very risky files twice, instead of files that are deemed stable.
Linespots takes the idea and expands it to allow single lines of code to be rated. This offers reviewers a higher resolution of results and risk assessments which then increases the chance of actually finding bugs in the results.
I found, that by analyzing 0.5% lines of code with the highest risk values in a project, an average of 50% of the bugs fixed in the next 150 commits were correctly predicted by Linespots. This is an improvement by factor 10 compared to Bugspots.