Sha256: 73e6c7e162bdebced5b0fd3081744eddb24c76183530b6f36eefd73e80bd2fdb

Contents?: true

Size: 747 Bytes

Versions: 4

Compression:

Stored size: 747 Bytes

Contents

require 'simplabs/excellent/checks/base'

module Simplabs

  module Excellent

    module Checks

      # This check reports class variables. Class variables in Ruby have a very complicated inheritance policy that often leads to errors. Usually class
      # variables can be replaced with another construct which will also lead to better design.
      #
      # ==== Applies to
      #
      # * class variables
      class SingletonVariableCheck < Base

        def initialize #:nodoc:
          super
          @interesting_nodes = [:cvar]
        end

        def evaluate(context) #:nodoc:
          add_warning(context, 'Singleton variable {{variable}} used.', { :variable => context.full_name })
        end

      end

    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
simplabs-excellent-1.2.1 lib/simplabs/excellent/checks/singleton_variable_check.rb
simplabs-excellent-1.2.2 lib/simplabs/excellent/checks/singleton_variable_check.rb
simplabs-excellent-1.3.0 lib/simplabs/excellent/checks/singleton_variable_check.rb
simplabs-excellent-1.3.1 lib/simplabs/excellent/checks/singleton_variable_check.rb