class RuboCop::Cop::Style::SpaceInsideHashLiteralBraces

def incorrect_style_detected(t1, t2, expect_space, is_empty_braces)

def incorrect_style_detected(t1, t2, expect_space, is_empty_braces)
  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
    if expect_space
      if t1.text == t2.text
        ambiguous_style_detected(:no_space, :compact)
      else
        unexpected_style_detected(:no_space)
      end
    elsif t1.text == t2.text
      unexpected_style_detected(:space)
    else
      ambiguous_style_detected(:space, :compact)
    end
  end
end