Coverage reporting

Using GitStats to show fragility

The GitStats binaries can be downloaded here (download).

GitStats is in early development but is already proven to be helpful in finding areas of low quality code. GitStats requires .NET to run and will work on any Git repository for any language. It’s a code quality tool focused on repository behavior rather than the code itself. GitStats currently only emits a Brittles report. Brittles shows fragility in your code my measuring how much files change. A continuously changing file likely needs:

This shows the percent times a particular file has been modified over a series of commits. The example below shows a run for 50 commits on a non-master branch.

FileName # Times Changed % Times Changed
xxx\BLL\Services\Orders\OrderDuplicationService.cs 15 30.0
xxx\OrderDetail.aspx.cs 15 35.2
xxx\DAO\OrderDAO.cs 11 21.60
xxx\Payment.aspx.cs 6 13.10
xxx\OrderLogistics.aspx 5 12.7
xxx\DAO\GiftCertificateDAO.cs 5 12.6
xxx\BLL\Services\Payments\GiftCertificate\GiftCertificate.cs 5 11.2
xxx\Services\Orders.asmx.cs 4 8.00
xxx\BLL\Services\Cart\CartValidationService.cs 4 7.91
xxx\BLL\Services\Fees\FeeService.cs 4 7.91
xxx\UserControls\OrderDetails\CartSummary\ConfirmOrderSummary.ascx 3 6.00

In this example, it’s clear the first file is being changed quite a bit. There’s a 30% chance that any commit will touch this file. It’s a great idea for this team to make that file as clean and easy to use as possible. It could also indicate this file is very buggy. If a file is committed frequently, normally it indicates that bugs are found and it’s taking several commits to get it right. It’s best to get this file under unit test with a high percent unit test coverage. Using GitStats to show fragility is a strong technique to show file-level code quality.

I’m looking forward to adding more features to GitStats. Please send any repository-level metrics you’d like to see.