Sha256: 0f37b860cd2ff424001b317034b70e14b8c5171b6faec567928fdd3cbdbc5e2f

Contents?: true

Size: 731 Bytes

Versions: 18

Compression:

Stored size: 731 Bytes

Contents

# encoding: utf-8

module RuboCop
  module Cop
    module Style
      # This cop makes sure that all variables use the configured style,
      # snake_case or camelCase, for their names.
      class VariableName < Cop
        include ConfigurableNaming

        def on_lvasgn(node)
          name, = *node
          check_name(node, name, node.loc.name)
        end

        def on_ivasgn(node)
          name, = *node
          check_name(node, name, node.loc.name)
        end

        def on_cvasgn(node)
          name, = *node
          check_name(node, name, node.loc.name)
        end

        private

        def message(style)
          format('Use %s for variable names.', style)
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
rubyjobbuilderdsl-0.0.2 vendor/bundle/ruby/2.1.0/gems/rubocop-0.26.0/lib/rubocop/cop/style/variable_name.rb
rubyjobbuilderdsl-0.0.1 vendor/bundle/ruby/2.1.0/gems/rubocop-0.26.0/lib/rubocop/cop/style/variable_name.rb
rubocop-0.34.2 lib/rubocop/cop/style/variable_name.rb
rubocop-0.34.1 lib/rubocop/cop/style/variable_name.rb
rubocop-0.34.0 lib/rubocop/cop/style/variable_name.rb
rubocop-0.33.0 lib/rubocop/cop/style/variable_name.rb
rubocop-0.32.1 lib/rubocop/cop/style/variable_name.rb
rubocop-0.32.0 lib/rubocop/cop/style/variable_name.rb
rubocop-0.31.0 lib/rubocop/cop/style/variable_name.rb
rubocop-0.30.1 lib/rubocop/cop/style/variable_name.rb
rubocop-0.30.0 lib/rubocop/cop/style/variable_name.rb
rubocop-0.29.1 lib/rubocop/cop/style/variable_name.rb
rubocop-0.29.0 lib/rubocop/cop/style/variable_name.rb
rubocop-0.28.0 lib/rubocop/cop/style/variable_name.rb
rubocop-0.27.1 lib/rubocop/cop/style/variable_name.rb
rubocop-0.27.0 lib/rubocop/cop/style/variable_name.rb
rubocop-0.26.1 lib/rubocop/cop/style/variable_name.rb
rubocop-0.26.0 lib/rubocop/cop/style/variable_name.rb