class RubyCritic::AnalysedModulesCollection

def average_limited_cost

def average_limited_cost
  avg = map { |mod| limited_cost_for(mod) }.reduce(:+) / @modules.size.to_f
  [avg, ZERO_SCORE_COST].min
end

def each(&block)

def each(&block)
  @modules.each(&block)
end

def initialize(paths)

def initialize(paths)
  @modules = SourceLocator.new(paths).pathnames.map do |pathname|
    AnalysedModule.new(pathname: pathname)
  end
end

def limited_cost_for(mod)

def limited_cost_for(mod)
  [mod.cost, COST_LIMIT].min
end

def score

def score
  MAX_SCORE - average_limited_cost * COST_MULTIPLIER
rescue
  0.0
end

def to_json(*options)

def to_json(*options)
  @modules.to_json(*options)
end