Class: RuboCop::Cop::Elegant::PairedBrackets

Inherits:
Base
  • Object
show all
Defined in:
lib/rubocop/cop/elegant/paired_brackets.rb

Overview

Enforces the “paired brackets” notation: every round, square, or curly bracket must either be paired with its matching counterpart on the same line, or end its own line (when opening) or start its own line (when closing). Brackets stranded in the middle of a multi-line expression are forbidden because they hide the structure of the code.

See www.yegor256.com/2014/10/23/paired-brackets-notation.html

Constant Summary collapse

MSG =
'Bracket %<text>s must be paired on the same line, or start/end its line'

Instance Method Summary collapse

Instance Method Details

#on_new_investigationObject



23
24
25
26
# File 'lib/rubocop/cop/elegant/paired_brackets.rb', line 23

def on_new_investigation
  super
  pair.each { |duo| check(duo) }
end