class RuboCop::Cop::Layout::SpaceInsideHashLiteralBraces

def incorrect_style_detected(token1, token2,

def incorrect_style_detected(token1, token2,
                             expect_space, is_empty_braces)
  brace = (token1.text == '{' ? token1 : token2).pos
  range = expect_space ? brace : space_range(brace)
  detected_style = expect_space ? 'no_space' : 'space'
  add_offense(range, message: message(brace, is_empty_braces, expect_space)) do |corrector|
    autocorrect(corrector, range)
    ambiguous_or_unexpected_style_detected(detected_style, token1.text == token2.text)
  end
end