Sha256: 2552bc5b4ade7bd923c96bb90002d98a7111682db830bc829b230e01c83edfb3

Contents?: true

Size: 745 Bytes

Versions: 8

Compression:

Stored size: 745 Bytes

Contents

require 'roodi/checks/check'

module Roodi
  module Checks
    # 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.
    class ClassVariableCheck < Check
      def interesting_nodes
        [:cvar]
      end

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

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
threedaymonk-roodi-1.3.8 lib/roodi/checks/class_variable_check.rb
roodi-1.3.5 lib/roodi/checks/class_variable_check.rb
roodi-1.3.2 lib/roodi/checks/class_variable_check.rb
roodi-1.3.3 lib/roodi/checks/class_variable_check.rb
roodi-1.3.4 lib/roodi/checks/class_variable_check.rb
roodi-1.3.7 lib/roodi/checks/class_variable_check.rb
roodi-1.4.0 lib/roodi/checks/class_variable_check.rb
roodi-1.3.6 lib/roodi/checks/class_variable_check.rb