Class: Rubocop::Cop::Style::ClassVars
- Defined in:
- lib/rubocop/cop/style/class_vars.rb
Overview
This cop checks for uses of class variables. Offences are signaled only on assignment to class variables to reduced the number of offences that would be reported.
Constant Summary collapse
- MSG =
'Replace class var %s with a class instance var.'
Constants inherited from Cop
Instance Attribute Summary
Attributes inherited from Cop
#config, #corrections, #offences, #processed_source
Instance Method Summary collapse
Methods inherited from Cop
#add_offence, all, #autocorrect?, #convention, #cop_config, cop_name, #cop_name, cop_type, #debug?, #ignore_node, inherited, #initialize, lint?, non_rails, rails?, style?, #support_autocorrect?, #warning
Constructor Details
This class inherits a constructor from Rubocop::Cop::Cop
Instance Method Details
#message(node) ⇒ Object
16 17 18 19 |
# File 'lib/rubocop/cop/style/class_vars.rb', line 16 def (node) class_var, = *node MSG.format(class_var) end |
#on_cvasgn(node) ⇒ Object
12 13 14 |
# File 'lib/rubocop/cop/style/class_vars.rb', line 12 def on_cvasgn(node) convention(node, :name) end |