Sha256: 86cfcebd9c9860494f518afe3adf5f12b75db628c80613f1b3be4b67d8c950b6

Contents?: true

Size: 547 Bytes

Versions: 4

Compression:

Stored size: 547 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    module Style
      # 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.
      class ClassVars < Cop
        MSG = 'Replace class var %s with a class instance var.'

        def on_cvasgn(node)
          add_offence(node, :name)
        end

        def message(node)
          class_var, = *node
          MSG.format(class_var)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubocop-0.18.1 lib/rubocop/cop/style/class_vars.rb
rubocop-0.18.0 lib/rubocop/cop/style/class_vars.rb
rubocop-0.17.0 lib/rubocop/cop/style/class_vars.rb
rubocop-0.16.0 lib/rubocop/cop/style/class_vars.rb