Sha256: 96f1e78c512a3088596ad2033e4b6d60a8b058a76f45a722106eb6df60e15a52
Contents?: true
Size: 856 Bytes
Versions: 2
Compression:
Stored size: 856 Bytes
Contents
module TheMetricSystem::UnitsOfMeasure class FlogUnits def self.reasonable_defaults { :threshold => 25, :directories => ['lib'] } end def self.report_to_standards_body(options={}) options.merge!(reasonable_defaults) # Don't like this, but still getting used to this whole, don't require rubygems in classes thing # Will refactor soon require 'flog' flog = Flog.new :methods => true flog.flog options[:directories] threshold = options[:threshold] bad_methods = flog.totals.select { |name, score| score > threshold } bad_methods.sort { |a,b| a[1] <=> b[1] }.each do |name, score| puts "%8.1f: %s" % [score, name] end raise "Flog found #{bad_methods.size} methods with a complexity > #{options[:threshold]}" unless bad_methods.empty? end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
spicycode-the_metric_system-2.3.4 | lib/the_metric_system/units_of_measure/flog_units.rb |
spicycode-the_metric_system-2.3.5 | lib/the_metric_system/units_of_measure/flog_units.rb |