Class Roodi::Checks::CyclomaticComplexityMethodCheck
In: lib/roodi/checks/cyclomatic_complexity_method_check.rb
Parent: CyclomaticComplexityCheck

Checks cyclomatic complexity of a method against a specified limit.

The cyclomatic complexity is measured by the number of "if", "unless", "elsif", "?:", "while", "until", "for", "rescue", "case", "when", "&&", "and", "||" and "or" statements (plus one) in the body of the member. It is a measure of the minimum number of possible paths through the source and therefore the number of required tests.

Generally, for a method, 1-4 is considered good, 5-8 ok, 9-10 consider re-factoring, and 11+ re-factor now!

Methods

Constants

DEFAULT_COMPLEXITY = 8

Public Class methods

Public Instance methods

[Validate]