Sha256: 2c62913941c2a2caf3d4db3c3f8029fbf2ecce41dd6392ad9d4c974b7cc4c5fb
Contents?: true
Size: 822 Bytes
Versions: 23
Compression:
Stored size: 822 Bytes
Contents
module Quality module Tools # Adds 'flog' tool support to quality gem module Flog private 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.included(base) base.extend ClassMethods end # See Flog.included module ClassMethods 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 end end end end
Version data entries
23 entries across 23 versions & 1 rubygems