Sha256: 8ba80024f50a630171edc116f7cf8d4756a5c3472d82b97857b9a8383210c877

Contents?: true

Size: 768 Bytes

Versions: 26

Compression:

Stored size: 768 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module RSpec
      # Checks that the first argument to an example group is not empty.
      #
      # @example
      #   # bad
      #   describe do
      #   end
      #
      #   RSpec.describe do
      #   end
      #
      #   # good
      #   describe TestedClass do
      #   end
      #
      #   describe "A feature example" do
      #   end
      class MissingExampleGroupArgument < Base
        MSG = 'The first argument to `%<method>s` should not be empty.'

        def on_block(node)
          return unless example_group?(node)
          return if node.send_node.arguments?

          add_offense(node, message: format(MSG, method: node.method_name))
        end
      end
    end
  end
end

Version data entries

26 entries across 24 versions & 2 rubygems

Version Path
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/missing_example_group_argument.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-rspec-2.9.0/lib/rubocop/cop/rspec/missing_example_group_argument.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/missing_example_group_argument.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rubocop-rspec-2.9.0/lib/rubocop/cop/rspec/missing_example_group_argument.rb
rubocop-rspec-2.12.1 lib/rubocop/cop/rspec/missing_example_group_argument.rb
rubocop-rspec-2.12.0 lib/rubocop/cop/rspec/missing_example_group_argument.rb
rubocop-rspec-2.11.1 lib/rubocop/cop/rspec/missing_example_group_argument.rb
rubocop-rspec-2.11.0 lib/rubocop/cop/rspec/missing_example_group_argument.rb
rubocop-rspec-2.10.0 lib/rubocop/cop/rspec/missing_example_group_argument.rb
rubocop-rspec-2.9.0 lib/rubocop/cop/rspec/missing_example_group_argument.rb
rubocop-rspec-2.8.0 lib/rubocop/cop/rspec/missing_example_group_argument.rb
rubocop-rspec-2.7.0 lib/rubocop/cop/rspec/missing_example_group_argument.rb
rubocop-rspec-2.6.0 lib/rubocop/cop/rspec/missing_example_group_argument.rb
rubocop-rspec-2.5.0 lib/rubocop/cop/rspec/missing_example_group_argument.rb
rubocop-rspec-2.4.0 lib/rubocop/cop/rspec/missing_example_group_argument.rb
rubocop-rspec-2.3.0 lib/rubocop/cop/rspec/missing_example_group_argument.rb
rubocop-rspec-2.2.0 lib/rubocop/cop/rspec/missing_example_group_argument.rb
rubocop-rspec-2.1.0 lib/rubocop/cop/rspec/missing_example_group_argument.rb
rubocop-rspec-2.0.1 lib/rubocop/cop/rspec/missing_example_group_argument.rb
rubocop-rspec-2.0.0 lib/rubocop/cop/rspec/missing_example_group_argument.rb