module RuboCop::Cop::CodeLength

def check_code_length(node)

def check_code_length(node)
  # Skip costly calculation when definitely not needed
  return if node.line_count <= max_length
  calculator = build_code_length_calculator(node)
  length = calculator.calculate
  return if length <= max_length
  location = node.casgn_type? ? node.loc.name : node.loc.expression
  add_offense(location, message: message(length, max_length)) do
    self.max = length
  end
end