9uac1q
Last Updated: February 25, 2016
·
1.634K
· calamari
6b4b7f11163b1e87571995ce8c3f0bce

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
Say Thanks
Respond

2 Responses
Add your response

1347

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 ·
1355
6b4b7f11163b1e87571995ce8c3f0bce

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 ·