Class: Rubocop::Cop::SpaceAroundEqualsInParameterDefault
- 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 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
#inspect(file, source, tokens, sexp) ⇒ Object
167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'lib/rubocop/cop/surrounding_space.rb', line 167 def inspect(file, source, tokens, sexp) each(:params, sexp) do |s| (s[2] || []).each do |param, _| param_pos = param.last ix = tokens.index { |t| t.pos == param_pos } unless whitespace?(tokens[ix + 1]) && whitespace?(tokens[ix + 3]) add_offence(:convention, param[-1].lineno, 'Surrounding space missing in default value ' + 'assignment.') end end end end |