Sha256: 01abeb2b89f61e92061fa0efc34220a8b460fb2abfef7ce6f54fe94bd8140cfb

Contents?: true

Size: 666 Bytes

Versions: 5

Compression:

Stored size: 666 Bytes

Contents

# encoding: utf-8

module RuboCop
  module Cop
    module Style
      # This cop makes sure that all methods use the configured style,
      # snake_case or camelCase, for their names. Some special arrangements
      # have to be made for operator methods.
      class MethodName < Cop
        include ConfigurableNaming

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

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

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

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
rubyjobbuilderdsl-0.0.2 vendor/bundle/ruby/2.1.0/gems/rubocop-0.26.0/lib/rubocop/cop/style/method_name.rb
rubyjobbuilderdsl-0.0.1 vendor/bundle/ruby/2.1.0/gems/rubocop-0.26.0/lib/rubocop/cop/style/method_name.rb
rubocop-0.26.1 lib/rubocop/cop/style/method_name.rb
rubocop-0.26.0 lib/rubocop/cop/style/method_name.rb
rubocop-0.25.0 lib/rubocop/cop/style/method_name.rb