class RuboCop::Cop::Layout::SpaceBeforeBlockBraces
def on_block(node)
def on_block(node) return if node.keywords? # Do not register an offense for multi-line braces when specifying # `EnforcedStyle: no_space`. It will conflict with autocorrection # by `EnforcedStyle: line_count_based` of `Style/BlockDelimiters` cop. # That means preventing autocorrection to incorrect autocorrected # code. # See: https://github.com/rubocop/rubocop/issues/7534 return if conflict_with_block_delimiters?(node) left_brace = node.loc.begin space_plus_brace = range_with_surrounding_space(left_brace) used_style = space_plus_brace.source.start_with?('{') ? :no_space : :space if empty_braces?(node.loc) check_empty(left_brace, space_plus_brace, used_style) else check_non_empty(left_brace, space_plus_brace, used_style) end end