Abc Size

A rubocop tale

Counts the number of 

Assignments (A), 

Branches (B) and 

Conditions (C)

and assigns a single numerical score calculated as:

 |ABC| = sqrt((A*A)+(B*B)+(C*C))
  • Assignment -- an explicit transfer of data into a variable, e.g. = *= /= %= += <<= >>= &= |= ^= >>>= ++ --
  • Branch -- an explicit forward program branch out of scope -- a function call, class method call, or new operator
  • Condition -- a logical/Boolean test, == != <= >= < > else case default try catch ? and unary conditionals.
 |ABC| = sqrt((A*A)+(B*B)+(C*C))
  • 0-10 = Awesome
  • 11-20 = Good enough
  • 21-40 = Might need refactoring
  • 41-60 = Possible to justify
  • 61-100 = Danger
  • 100-200 = Whoop, whoop, whoop
  • 200 + = Someone please think of the children

ABC is strictly a software size metric, although it has often been misconstrued as a complexity metric.

warning

Abc Size

By Stjepan Hadjić

Abc Size

  • 756