Automated code goodness checking with cane

A script to run cane in a project

A few nights ago, I added Xavier Shay’s cane to Sifter. It was super simple, and cane runs surprisingly fast. Cane is designed to run as part of CI, but Sifter doesn’t really an actual CI box. Instead, I’ve added it to our preflight script that tells us whether deploying is a good idea or not, based on our spec suite. Now that preflight can tell us if we’ve regressed on code complexity or style as well. I’m pretty pumped about this setup.

Next step: add glib comments on failure. I’m thinking of something like “Yo, imma let you finish but the code you’re about to deploy is not that great.”

2 thoughts on “Automated code goodness checking with cane

  1. Hey Adam,

    Great post. Cane looks very nice. I’m exploring how to add red/green alerts or workflow gate features to Code Climate, so this is a great use case.

    What else do you run in your preflight suite?

  2. Right now we’re just running our spec suites and using cane to cap the complexity of our code. I’d like to add doc and style constraints soon. The ability to check other metrics via a file (e.g. coverage) is also very tempting.

    I gave Pelusa a look and it’s quite promising. I think ABC complexity in concert with method/class size could be a really useful set of proxies to code goodness.

Comments are closed.