Sha256: b1d9f299a6f0f3681269119795054180905d32c8b8643979f5281e3a48e1c0e6

Contents?: true

Size: 865 Bytes

Versions: 16

Compression:

Stored size: 865 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Naming
      # This cop makes sure that all methods use the configured style,
      # snake_case or camelCase, for their names.
      #
      # @example EnforcedStyle: snake_case (default)
      #   # bad
      #   def fooBar; end
      #
      #   # good
      #   def foo_bar; end
      #
      # @example EnforcedStyle: camelCase
      #   # bad
      #   def foo_bar; end
      #
      #   # good
      #   def fooBar; end
      class MethodName < Cop
        include ConfigurableNaming

        MSG = 'Use %<style>s for method names.'.freeze

        def on_def(node)
          check_name(node, node.method_name, node.loc.name)
        end
        alias on_defs on_def

        private

        def message(style)
          format(MSG, style: style)
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
rubocop-0.59.2 lib/rubocop/cop/naming/method_name.rb
rubocop-0.59.1 lib/rubocop/cop/naming/method_name.rb
rubocop-0.59.0 lib/rubocop/cop/naming/method_name.rb
rubocop-0.58.2 lib/rubocop/cop/naming/method_name.rb
rubocop-0.58.1 lib/rubocop/cop/naming/method_name.rb
rubocop-0.58.0 lib/rubocop/cop/naming/method_name.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/rubocop-0.57.2/lib/rubocop/cop/naming/method_name.rb
rubocop-0.57.2 lib/rubocop/cop/naming/method_name.rb
rubocop-0.57.1 lib/rubocop/cop/naming/method_name.rb
rubocop-0.57.0 lib/rubocop/cop/naming/method_name.rb
rubocop-0.56.0 lib/rubocop/cop/naming/method_name.rb
rubocop-0.55.0 lib/rubocop/cop/naming/method_name.rb
rubocop-0.54.0 lib/rubocop/cop/naming/method_name.rb
rubocop-0.53.0 lib/rubocop/cop/naming/method_name.rb
rubocop-0.52.1 lib/rubocop/cop/naming/method_name.rb
rubocop-0.52.0 lib/rubocop/cop/naming/method_name.rb