Static Code Analysis

I started using a tool this week that measures the lines of code (LOC) that are going into our source tree. I discovered several things that make me believe that measuring how much code we've written (along the lines of TSP or PSP) and some of the other properties of the code base can help me assess the state of the project. I learned:

  • It takes at least as much code to test something as it does to build something. Our test depot has 245,000 LOC, and our dev depot has 215,000. Automated testing simply has to embrace best development practices; the scope of the investment demands it.
  • Making incremental measurements so that I see the change over our milestone on a per week basis shows me when the dev team has really stopped adding code, and is stabilizing. Our dev team was averaging 1500 LOC per week for 9 weeks, and this last week, the number of files and code actualy decreased slightly. This is good, because we are entering a bug fixing/stabilization phase.
  • I need to learn how to apply cyclomatic complexity to our code base. According to the numbers I saw, our maximum complexity was 97 in the dev code base, and 52 on test. According to the references I reviewed, anything over 40, and you should think hard about rewriting this code.