Andrew Thorp

Cane - Ruby code quality thresholds

Xavier Shay, an engineer at Square, has released Cane, a tool that gives you “code quality threshold checking as part of your build”. Cane checks things like Style Metrics (Line length), ABC Metrics, Documentation, etc. It shines against some of the other code quality tools out there for a number of reasons:

  • 1.9 based
  • Low false positives
  • Very fast (even on large code bases)
  • Zero external dependencies

Using it is simple:

gem install cane
cane --abc-glob '{lib,spec}/**/*.rb' --abc-max 15

I spoke with Xavier, and two things he would love to see from the community are a flag for machine readable output, with an easy way to hook it into Jenkins, and a “sane way to wire in new checks.” Currently, extending cane requires you edit far too many files, visit this pull request for some background.

This is an extremely small, fast, and easy-to-use project that gives you some very cool features with a very small learning curve. View the Source at GitHub.


Sign in or Join to comment or subscribe

Player art
  0:00 / 0:00