Sha256: 5bfe3a9391e94669b6cac3922e2dc06b8456aa7f731d2566478ba8a07001aa89

Contents?: true

Size: 901 Bytes

Versions: 24

Compression:

Stored size: 901 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.'

        def on_def(node)
          return if node.operator_method?

          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

24 entries across 16 versions & 2 rubygems

Version Path
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/rubocop-0.74.0/lib/rubocop/cop/naming/method_name.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/rubocop-0.72.0/lib/rubocop/cop/naming/method_name.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/rubocop-0.72.0/lib/rubocop/cop/naming/method_name.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/rubocop-0.74.0/lib/rubocop/cop/naming/method_name.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/rubocop-0.72.0/lib/rubocop/cop/naming/method_name.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/rubocop-0.74.0/lib/rubocop/cop/naming/method_name.rb
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/rubocop-0.74.0/lib/rubocop/cop/naming/method_name.rb
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/rubocop-0.72.0/lib/rubocop/cop/naming/method_name.rb
zuora_connect_ui-0.8.3 vendor/ruby/2.6.0/gems/rubocop-0.74.0/lib/rubocop/cop/naming/method_name.rb
zuora_connect_ui-0.8.3 vendor/ruby/2.6.0/gems/rubocop-0.72.0/lib/rubocop/cop/naming/method_name.rb
zuora_connect_ui-0.8.2 vendor/ruby/2.6.0/gems/rubocop-0.74.0/lib/rubocop/cop/naming/method_name.rb
zuora_connect_ui-0.8.2 vendor/ruby/2.6.0/gems/rubocop-0.72.0/lib/rubocop/cop/naming/method_name.rb
zuora_connect_ui-0.8.1 vendor/ruby/2.6.0/gems/rubocop-0.72.0/lib/rubocop/cop/naming/method_name.rb
zuora_connect_ui-0.8.1 vendor/ruby/2.6.0/gems/rubocop-0.74.0/lib/rubocop/cop/naming/method_name.rb
zuora_connect_ui-0.8.0 vendor/ruby/2.6.0/gems/rubocop-0.74.0/lib/rubocop/cop/naming/method_name.rb
zuora_connect_ui-0.8.0 vendor/ruby/2.6.0/gems/rubocop-0.72.0/lib/rubocop/cop/naming/method_name.rb
rubocop-0.74.0 lib/rubocop/cop/naming/method_name.rb
rubocop-0.73.0 lib/rubocop/cop/naming/method_name.rb
zuora_connect_ui-0.7.1 vendor/ruby/2.6.0/gems/rubocop-0.72.0/lib/rubocop/cop/naming/method_name.rb
zuora_connect_ui-0.7.0 vendor/ruby/2.6.0/gems/rubocop-0.72.0/lib/rubocop/cop/naming/method_name.rb