Eric Hodel (drbrain) wrote,
Eric Hodel
drbrain

Code Metrics

One of the great things about having source control is that you can perform analysis on the code you've checked in over time. This weekend I rewrote the commit email script to categorize the line changes, so now I get output like this in the commit emails:

Total Changed:	+ 71	- 80
Code Changed:	+ 16	- 65
Test Changed:	+ 55	- 15


If you had just the Total Changed line, you'd think that this commit wasn't very special. With the categorization, you can see that the commit had a large boost in the quality of the code, replacing a large chunk of code with fewer lines and adding many (probably missing) lines of test.

I then wrote a second script using the changes to the commit email so I could collect statistics on the whole of a commiter's work:

Author: eric
        Change: Code    8022    22238   -14216
        Change: Config  13      498     -485
        Change: Other   93415   125369  -31954
        Change: Test    1668    6666    -4998
        Change: Total   104444  156387  -51943
        Change: WWW     323     613     -290


The columns are added - removed, added, removed. (I have a huge number of Other because I've been adding all the machine configuration files, major cheating!) Comparing just added lines, I'm 3:1 code:test, comparing 'live' lines, I'm 5:1.

My next step will be to turn this into a graph so that its easier to visualize how the code has changed over time.
Subscribe
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 0 comments