Module: Quality::Tools::Flog::ClassMethods

Defined in:
lib/quality/tools/flog.rb

Overview

See Flog.included

Instance Method Summary collapse

Instance Method Details

#count_violations_in_flog_output(line, threshold = 50) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/quality/tools/flog.rb', line 22

def count_violations_in_flog_output(line, threshold = 50)
  return 0 if line =~ /^ *([0-9.]*): flog total$/

  return 0 unless line =~ /^ *([0-9.]*): (.*) .*.rb:[0-9]*$/

  score = Regexp.last_match[1].to_i

  return 1 if score > threshold

  0
end