2013-03-31

I recently wrote githubinfo. It
is a quick and handy script that queries the github API of one or more
organizations and gives you a simple report on the amount of commits with
tests in the last week.

I figured it could be useful to others, so I made it available on pypi,
including reasonable documentation of course:
https://pypi.python.org/pypi/githubinfo . You can pip install
githubinfo (or put it in your buildout).

It is just a simple single command and the output looks like this:

Goal

I wrote it because we wanted to improve our development process at Nelen &
Schuurmans. We wanted more tests. So I
wrote a script:

It queries the github API for one or more organizations (or personal
accounts).

It queries the projects in there for commmits in the last week
(configurable).

For every commit, it simply looks if there's a filename in the commit with
test in its full path. If so, the commit counts as a "test commit".

For every project, it counts the number of commits and the number of test
commits.

The same for every committer.

At the end, you get a list of projects and committers sorted by number of
commits.

Risk: you get what you measure

The metric is incomplete and imprecise. The same people that start grabbing
their torches and pitchforks when someone mentions "code coverage" will start
grabbing them now. My answer: bugger off.

You identify colleagues that never ever bother to test. You get to educate
them. Can I borrow that pitchfork, please?

You identify projects that have improved in quality.

You identify projects that were obviously troubled by a deadline and that
might bite you later on if you have to use them yourself.

You identify colleagues that bring quality to your project if you work with
them.

There are a lot of things you don't measure. But someone who doesn't bother
with tests also isn't going to bother adding a whiteline somewhere in a test
file to get at least some test commit credited to his name :-)

Configurable

The defaults are all terribly Nelen &
Schuurmans centric. So there's a way to
customize it. See the pypi page
for the documentation on how to do it.

Try it out! My main goal it to get everyone more aware of testing and thereby
hopefully to increase the amounts of tests.

Show more