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:
- Targeted refactoring
- Unit testing
- Code coverage
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|
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.
Share this Post