class RubyCritic::AnalysedModule

def <=>(other)

def <=>(other)
  [rating.to_s, name] <=> [other.rating.to_s, other.name]
end

def complexity_per_method

def complexity_per_method
  if methods_count.zero?
    'N/A'
  else
    complexity.fdiv(methods_count).round(1)
  end
end

def cost

def cost
  @cost ||= smells.map(&:cost).inject(0, :+) + (complexity / 25)
end

def path

def path
  @path ||= pathname.to_s
end

def rating

def rating
  @rating ||= Rating.from_cost(cost)
end

def smells?

def smells?
  !smells.empty?
end

def smells_at_location(location)

def smells_at_location(location)
  smells.select { |smell| smell.at_location?(location) }
end

def to_h

def to_h
  {
    name: name,
    path: path,
    smells: smells,
    churn: churn,
    committed_at: committed_at,
    complexity: complexity,
    duplication: duplication,
    methods_count: methods_count,
    cost: cost,
    rating: rating
  }
end

def to_json(*a)

def to_json(*a)
  to_h.to_json(*a)
end