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:

David Goodger said...

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.

Anonymous said...

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.

Grig Gheorghiu said...

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

Grig

Grig Gheorghiu said...

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

Anonymous said...

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

Sofia said...

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.

Grig Gheorghiu said...

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

Modifying EC2 security groups via AWS Lambda functions

One task that comes up again and again is adding, removing or updating source CIDR blocks in various security groups in an EC2 infrastructur...