Sha256: d03469baacc118dd1dd2d84fac37e5300b0474f7ee0b67c5badf8f20f301ffbc
Contents?: true
Size: 1.24 KB
Versions: 20
Compression:
Stored size: 1.24 KB
Contents
module Simplabs module Excellent module Parsing module CyclomaticComplexityMeasure #:nodoc: COMPLEXITY_NODE_TYPES = [:if, :while, :until, :for, :rescue, :case, :when, :and, :or] def process_if(exp) add_complexity_score(1) super end def process_while(exp) add_complexity_score(1) super end def process_until(exp) add_complexity_score(1) super end def process_for(exp) add_complexity_score(1) super end def process_rescue(exp) add_complexity_score(1) super end def process_case(exp) add_complexity_score(1) super end def process_when(exp) add_complexity_score(1) super end def process_and(exp) add_complexity_score(1) super end def process_or(exp) add_complexity_score(1) super end def cc_score @cc_score + 1 rescue 1 end private def add_complexity_score(score) @cc_score ||= 0 @cc_score += score end end end end end
Version data entries
20 entries across 20 versions & 2 rubygems