Sha256: ab82b4bfb43b35e2880d8f5de433da6947c22587aac716011e706b31c7466208
Contents?: true
Size: 699 Bytes
Versions: 20
Compression:
Stored size: 699 Bytes
Contents
# frozen_string_literal: true module Quality module Tools # Adds 'flog' tool support to quality gem class Flog < Tool 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 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 end end end
Version data entries
20 entries across 20 versions & 1 rubygems