Sha256: f1ced7b4d222ebad5940c44f004da08c1be625fcd59374583794fbdb54d2e4ed

Contents?: true

Size: 725 Bytes

Versions: 12

Compression:

Stored size: 725 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module RSpec
      # Avoid describing symbols.
      #
      # @example
      #   # bad
      #   describe :my_method do
      #     # ...
      #   end
      #
      #   # good
      #   describe '#my_method' do
      #     # ...
      #   end
      #
      # @see https://github.com/rspec/rspec-core/issues/1610
      class DescribeSymbol < Cop
        MSG = 'Avoid describing symbols.'

        def_node_matcher :describe_symbol?, <<-PATTERN
          (send #{RSPEC} :describe $sym ...)
        PATTERN

        def on_send(node)
          describe_symbol?(node) do |match|
            add_offense(match)
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rubocop-rspec-1.42.0 lib/rubocop/cop/rspec/describe_symbol.rb
rubocop-rspec-1.41.0 lib/rubocop/cop/rspec/describe_symbol.rb
rubocop-rspec-1.40.0 lib/rubocop/cop/rspec/describe_symbol.rb
rubocop-rspec-1.39.0 lib/rubocop/cop/rspec/describe_symbol.rb
rubocop-rspec-1.38.1 lib/rubocop/cop/rspec/describe_symbol.rb
rubocop-rspec-1.38.0 lib/rubocop/cop/rspec/describe_symbol.rb
rubocop-rspec-1.37.1 lib/rubocop/cop/rspec/describe_symbol.rb
rubocop-rspec-1.37.0 lib/rubocop/cop/rspec/describe_symbol.rb
rubocop-rspec-1.36.0 lib/rubocop/cop/rspec/describe_symbol.rb
rubocop-rspec-1.35.0 lib/rubocop/cop/rspec/describe_symbol.rb
rubocop-rspec-1.34.1 lib/rubocop/cop/rspec/describe_symbol.rb
rubocop-rspec-1.34.0 lib/rubocop/cop/rspec/describe_symbol.rb