Class: Rubocop::Cop::Alias

Inherits:
Cop
  • Object
show all
Defined in:
lib/rubocop/cop/alias.rb

Constant Summary collapse

ERROR_MESSAGE =
'Use alias_method instead of alias.'

Instance Attribute Summary

Attributes inherited from Cop

#correlations, #offences

Instance Method Summary collapse

Methods inherited from Cop

#add_offence, #has_report?, inherited, #initialize

Constructor Details

This class inherits a constructor from Rubocop::Cop::Cop

Instance Method Details

#inspect(file, source, tokens, sexp) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/rubocop/cop/alias.rb', line 8

def inspect(file, source, tokens, sexp)
  each(:alias, sexp) do |s|
    lineno = s[1][1][1][2].lineno

    add_offence(
      :convention,
      lineno,
      ERROR_MESSAGE
    )
  end
end