Clone wiki

commit-metrics-toolkit / Home

Commit Metrics Toolkit

by Aman King


"With great power comes great responsibility!" -- Spider-Man's Uncle Ben

So is true for metrics. Please remember that metrics are an indicator, not a target or a conclusion. Read more here:


This is a command-line Ruby application that can generate pluggable metrics based on VCS logs. Supports Git, Hg, and TFS currently. The output is in CSV format, enabling further filtration or graph generation as needed.


To generate VCS logs for program input:

git log --name-status --since 2012-06-01 --until 2013-06-01
hg log --style xml -v -b default -d "jun 2012 to jun 2013" --no-merges
SET PATH=%PATH%;C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\
tf.exe history . /r /noprompt /version:D"2014-02-28"~D"2014-06-25" /format:detailed


bundle exec ruby toolkit.rb <hg|git|tfs> <path/to/log_file> <path/to/team_json_file> [<commits|metrics> [<start-date>:<end-date>]]


bundle exec ruby toolkit.rb git spec/fixtures/git_sample.log teams/sample_team.json
bundle exec ruby toolkit.rb hg spec/fixtures/hg_sample.xml teams/sample_team.json metrics 2013-01-01:2013-07-01
bundle exec ruby toolkit.rb tfs spec/fixtures/tfs_sample.log teams/sample_team.json commits 2012-01-01:2012-03-01


Filters for commit inclusion/exclusion can be created under lib/filters (look at existing filters).

Metrics for data aggregation can be created under lib/metrics (look at existing metrics).

For configuration of filters, metrics, etc, look at teams/sample_team.json

Provided filters:

  • code_related_commits
  • date_range
  • team_assignments

Provided metrics:

  • avg_commits_per_work_item
  • commits_with_tests
  • unit_tested_work_items
  • raw


Copyright 2013 Aman King

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.