class RuboCop::Cop::Metrics::CyclomaticComplexity
Loops can be said to have an exit condition, so they add one.
and ||/or is shorthand for a sequence of ifs, so they also add one.
operator (or keyword and) can be converted to a nested if statement,
else branch does not, since it doesn’t add a decision point. The &&
An if statement (or unless or ?:) increases the complexity by one. An
decision points and adds one.
linearly independent paths through a method. The algorithm counts
than the configured maximum. The cyclomatic complexity is the number of
This cop checks that the cyclomatic complexity of methods is not higher
def complexity_score_for(_node)
def complexity_score_for(_node) 1 end