Class: Roodi::Checks::ClassVariableCheck

Inherits:
Check
  • Object
show all
Defined in:
lib/roodi/checks/class_variable_check.rb

Overview

Checks to make sure class variables are not being used..

Class variables in Ruby have a complicated inheritance policy, and their use can lead to mistakes. Often an alternate design can be used to solve the problem instead.

This check is looking for a code smell rather than a definite error. If you're sure that you're doing the right thing, try turning this check off in your config file.

Constant Summary

Constants inherited from Check

Roodi::Checks::Check::NODE_TYPES

Instance Method Summary collapse

Methods inherited from Check

#add_error, #end_file, #errors, #evaluate_end, #evaluate_node, #evaluate_node_end, #evaluate_node_start, #initialize, make, #position, #start_file

Constructor Details

This class inherits a constructor from Roodi::Checks::Check

Instance Method Details

#evaluate_start(node) ⇒ Object


19
20
21
# File 'lib/roodi/checks/class_variable_check.rb', line 19

def evaluate_start(node)
  add_error "Don't use class variables. You might want to try a different design."
end

#interesting_nodesObject


15
16
17
# File 'lib/roodi/checks/class_variable_check.rb', line 15

def interesting_nodes
  [:cvar]
end