Last Updated: February 25, 2016
·
1.973K
· calamari

Use cane to measure code complexity

Try using the cane gem and check how complex your methods really are. This is a good method to find code you probably can/should improve.

Install and use like this:

gem install cane
cane --abc-glob '**/*.rb' --abc-max 15

2 Responses
Add your response

I like running

cane --abc-glob "{app,lib}/*/.rb" --abc-max 1 --no-doc --no-style

to give me neat complexity statistics of all non-test methods. The --abc-max 1 makes every method "fail" the cane test.

over 1 year ago ·

If you want to a list of all items, --abc-max 1 may be good, but most of the time you would only have time to look at the most complex methods, so every method is in bigger projects a bit of an overkill.
But that depends one what you want to achieve.

over 1 year ago ·