class Rubycritic::AnalysedFile

def complexity_per_method

def complexity_per_method
  if methods_count == 0
    "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 has_smells?

def has_smells?
  !smells.empty?
end

def name

def name
  @name ||= pathname.basename.sub_ext("").to_s
end

def path

def path
  @path ||= pathname.to_s
end

def rating

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

def smells_at_location(location)

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