Class: Rubocop::Cop::SpaceInsideHashLiteralBraces
- Includes:
- SurroundingSpace
- Defined in:
- lib/rubocop/cop/surrounding_space.rb
Instance Attribute Summary
Attributes inherited from Cop
#correlations, #debug, #disabled_lines, #offences
Instance Method Summary collapse
Methods included from SurroundingSpace
Methods inherited from Cop
#add_offence, cop_name, #has_report?, inherited, #initialize, #name
Constructor Details
This class inherits a constructor from Rubocop::Cop::Cop
Instance Method Details
#check_missing_space(tokens, ix, grammar_path) ⇒ Object
132 133 134 135 136 137 138 |
# File 'lib/rubocop/cop/surrounding_space.rb', line 132 def check_missing_space(tokens, ix, grammar_path) if self.class.config['EnforcedStyleIsWithSpaces'] check_space(tokens, ix, grammar_path, 'missing') do |t| !(whitespace?(t) || [:on_lbrace, :on_rbrace].include?(t.type)) end end end |
#check_unwanted_space(tokens, ix) ⇒ Object
140 141 142 143 144 145 146 147 |
# File 'lib/rubocop/cop/surrounding_space.rb', line 140 def check_unwanted_space(tokens, ix) unless self.class.config['EnforcedStyleIsWithSpaces'] grammar_path = @correlations[ix] or return check_space(tokens, ix, grammar_path, 'detected') do |t| whitespace?(t) end end end |