Sha256: 6836a04728f72015e33f527742d280474f3344ac8b89044e0ad84e6859929585

Contents?: true

Size: 798 Bytes

Versions: 8

Compression:

Stored size: 798 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]
          @interesting_files = [/\.rb$/, /\.erb$/]
        end

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

      end

    end

  end

end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
simplabs-excellent-1.4.0 lib/simplabs/excellent/checks/singleton_variable_check.rb
simplabs-excellent-1.4.1 lib/simplabs/excellent/checks/singleton_variable_check.rb
simplabs-excellent-1.4.2 lib/simplabs/excellent/checks/singleton_variable_check.rb
simplabs-excellent-1.5.0 lib/simplabs/excellent/checks/singleton_variable_check.rb
simplabs-excellent-1.5.1 lib/simplabs/excellent/checks/singleton_variable_check.rb
simplabs-excellent-1.5.2 lib/simplabs/excellent/checks/singleton_variable_check.rb
simplabs-excellent-1.5.3 lib/simplabs/excellent/checks/singleton_variable_check.rb
excellent-1.5.4 lib/simplabs/excellent/checks/singleton_variable_check.rb