Class: Quality::Tools::Flog
Overview
Adds ‘flog’ tool support to quality gem
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Tool
Constructor Details
This class inherits a constructor from Quality::Tools::Tool
Class Method Details
.count_violations_in_flog_output(line, threshold = 50) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/quality/tools/flog.rb', line 14 def self.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 |
Instance Method Details
#quality_flog ⇒ Object
7 8 9 10 11 12 |
# File 'lib/quality/tools/flog.rb', line 7 def quality_flog args = "--all --continue --methods-only #{ruby_files.join(' ')}" ratchet_quality_cmd('flog', args: args, emacs_format: true) do |line| self.class.count_violations_in_flog_output(line) end end |