.comment-link {margin-left:.6em;}

Agile Testing

Monday, March 31, 2008

Python code complexity metrics and tools

There's a buzz in the air around code complexity, metrics, code coverage, etc. It started with Matt Harrison's PyCon presentation, then Ned Batchelder jumped in with a nice McCabe cyclomatic complexity computation/visualization tool, and now David Stanek posted about his pygenie tool -- which also measures the McCabe cyclomatic complexity of Python code. Now it's time to unify all these ideas in one powerful tool that computes not only complexity but also path or at least branch coverage. This would make a nice Google Summer of Code project. Too bad the deadline for 2008 GSoC applications is in 7 hours...Maybe for next year.

Update: David Goodger left a comment pointing me to Martin Blais's snakefood package, which computes and shows dependencies for your Python code. It's a good complement to the tools I mentioned above.

7 Comments:

  • There's another very nice tool that may be useful: Snakefood by Martin Blais. It generates dependency graphs from Python code.

    Martin doesn't sing his own praises enough, so if you think it's a cool tool, please post about it.

    By Blogger David Goodger, at 12:09 PM  

  • The branch coverage issue is one that I'd like to take a better look at. It seems like a very important and interesting problem.

    By Anonymous David Stanek, at 12:19 PM  

  • Thanks, David -- I updated my post with a link to snakefood.

    Grig

    By Blogger Grig Gheorghiu, at 12:47 PM  

  • David S. -- you're right, we have no Python tool that currently does branch coverage. Ned's tool is a first step towards that goal I think.

    Grig

    By Blogger Grig Gheorghiu, at 12:55 PM  

  • There's also PyMetrics (http://sourceforge.net/projects/pymetrics/)

    By Anonymous Anonymous, at 1:24 PM  

  • Looks like it's 7 days now. I'm already set up to be a mentor or I'd consider applying for this kind of project. If someone does apply, they can ping me for feedback on their proposal. I can maybe even mentor it if tinypy doesn't get enough projects that I'm needed.

    By Blogger Seth, at 1:37 PM  

  • Seth -- thanks for bringing the SoC deadline extension to my attention. I emailed Matt, Ned and David Stanek asking them if they'd be interesting in putting together a project for a prospective SoC student. Good to know you're available to review applications etc.

    Grig

    By Blogger Grig Gheorghiu, at 2:05 PM  

Post a Comment

Links to this post:

Create a Link

<< Home