class RuboCop::Cop::Style::SpaceInsideHashLiteralBraces

def check(t1, t2)

def check(t1, t2)
  # No offense if line break inside.
  return if t1.pos.line < t2.pos.line
  return if t2.type == :tCOMMENT # Also indicates there's a line break.
  is_empty_braces = t1.text == '{' && t2.text == '}'
  expect_space = if is_empty_braces
                   cop_config['EnforcedStyleForEmptyBraces'] == 'space'
                 else
                   style == :space
                 end
  if offense?(t1, t2, expect_space)
    brace = (t1.text == '{' ? t1 : t2).pos
    range = expect_space ? brace : space_range(brace)
    add_offense(range, range, message(brace, is_empty_braces,
                                      expect_space)) do
      opposite_style_detected
    end
  else
    correct_style_detected
  end
end