rspec/rspec-core

View on GitHub

Showing 82 of 94 total issues

Method parser has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.

    def parser(options)
      OptionParser.new do |parser|
        parser.summary_width = 34

        parser.banner = "Usage: rspec [options] [files or directories]\n\n"
Severity: Minor
Found in lib/rspec/core/option_parser.rb - About 7 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

File example_group.rb has 460 lines of code (exceeds 250 allowed). Consider refactoring.

RSpec::Support.require_rspec_support 'recursive_const_methods'

module RSpec
  module Core
    # rubocop:disable Metrics/ClassLength
Severity: Minor
Found in lib/rspec/core/example_group.rb - About 7 hrs to fix

    Class ExampleGroup has 50 methods (exceeds 20 allowed). Consider refactoring.

        class ExampleGroup
          extend Hooks
    
          include MemoizedHelpers
          extend MemoizedHelpers::ClassMethods
    Severity: Minor
    Found in lib/rspec/core/example_group.rb - About 7 hrs to fix

      File exception_presenter.rb has 378 lines of code (exceeds 250 allowed). Consider refactoring.

      RSpec::Support.require_rspec_core "formatters/console_codes"
      RSpec::Support.require_rspec_core "formatters/snippet_extractor"
      RSpec::Support.require_rspec_core 'formatters/syntax_highlighter'
      RSpec::Support.require_rspec_support "encoded_string"
      
      
      Severity: Minor
      Found in lib/rspec/core/formatters/exception_presenter.rb - About 5 hrs to fix

        File example.rb has 343 lines of code (exceeds 250 allowed). Consider refactoring.

        module RSpec
          module Core
            # Wrapper for an instance of a subclass of {ExampleGroup}. An instance of
            # `RSpec::Core::Example` is returned by example definition methods
            # such as {ExampleGroup.it it} and is yielded to the {ExampleGroup.it it},
        Severity: Minor
        Found in lib/rspec/core/example.rb - About 4 hrs to fix

          Class Example has 33 methods (exceeds 20 allowed). Consider refactoring.

              class Example
                # @private
                #
                # Used to define methods that delegate to this example's metadata.
                def self.delegate_to_metadata(key)
          Severity: Minor
          Found in lib/rspec/core/example.rb - About 4 hrs to fix

            Class World has 32 methods (exceeds 20 allowed). Consider refactoring.

                class World
                  # @private
                  attr_reader :example_groups, :filtered_examples, :example_group_counts_by_spec_file
            
                  # Used internally to determine what to do when a SIGINT is received.
            Severity: Minor
            Found in lib/rspec/core/world.rb - About 4 hrs to fix

              File html_printer.rb has 331 lines of code (exceeds 250 allowed). Consider refactoring.

              require 'erb'
              
              module RSpec
                module Core
                  module Formatters
              Severity: Minor
              Found in lib/rspec/core/formatters/html_printer.rb - About 3 hrs to fix

                File metadata.rb has 326 lines of code (exceeds 250 allowed). Consider refactoring.

                module RSpec
                  module Core
                    # Each ExampleGroup class and Example instance owns an instance of
                    # Metadata, which is Hash extended to support lazy evaluation of values
                    # associated with keys that may or may not be used by any example or group.
                Severity: Minor
                Found in lib/rspec/core/metadata.rb - About 3 hrs to fix

                  Class Reporter has 28 methods (exceeds 20 allowed). Consider refactoring.

                    class Reporter
                      # @private
                      RSPEC_NOTIFICATIONS = Set.new(
                        [
                          :close, :deprecation, :deprecation_summary, :dump_failures, :dump_pending,
                  Severity: Minor
                  Found in lib/rspec/core/reporter.rb - About 3 hrs to fix

                    Class ConfigurationOptions has 27 methods (exceeds 20 allowed). Consider refactoring.

                        class ConfigurationOptions
                          # @param args [Array<String>] command line arguments
                          def initialize(args)
                            @args = args.dup
                            organize_options
                    Severity: Minor
                    Found in lib/rspec/core/configuration_options.rb - About 3 hrs to fix

                      Class ExceptionPresenter has 27 methods (exceeds 20 allowed). Consider refactoring.

                            class ExceptionPresenter
                              attr_reader :exception, :example, :description, :message_color,
                                          :detail_formatter, :extra_detail_formatter, :backtrace_formatter
                              private :message_color, :detail_formatter, :extra_detail_formatter, :backtrace_formatter
                      
                      
                      Severity: Minor
                      Found in lib/rspec/core/formatters/exception_presenter.rb - About 3 hrs to fix

                        File notifications.rb has 264 lines of code (exceeds 250 allowed). Consider refactoring.

                        RSpec::Support.require_rspec_core "formatters/console_codes"
                        RSpec::Support.require_rspec_core "formatters/exception_presenter"
                        RSpec::Support.require_rspec_core "formatters/helpers"
                        RSpec::Support.require_rspec_core "shell_escape"
                        
                        
                        Severity: Minor
                        Found in lib/rspec/core/notifications.rb - About 2 hrs to fix

                          Method initialize has 45 lines of code (exceeds 25 allowed). Consider refactoring.

                                def initialize
                                  # rubocop:disable Style/GlobalVars
                                  @start_time = $_rspec_core_load_started_at || ::RSpec::Core::Time.now
                                  # rubocop:enable Style/GlobalVars
                                  @expectation_frameworks = []
                          Severity: Minor
                          Found in lib/rspec/core/configuration.rb - About 1 hr to fix

                            Method filter_applies? has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.

                                    def filter_applies?(key, filter_value, metadata)
                                      silence_metadata_example_group_deprecations do
                                        return location_filter_applies?(filter_value, metadata) if key == :locations
                                        return id_filter_applies?(filter_value, metadata)       if key == :ids
                                        return filters_apply?(key, filter_value, metadata)      if Hash === filter_value
                            Severity: Minor
                            Found in lib/rspec/core/metadata_filter.rb - About 1 hr to fix

                            Cognitive Complexity

                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                            A method's cognitive complexity is based on a few simple rules:

                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                            • Code is considered more complex for each "break in the linear flow of the code"
                            • Code is considered more complex when "flow breaking structures are nested"

                            Further reading

                            Method ensure_hooks_initialized_for has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.

                                    def ensure_hooks_initialized_for(position, scope)
                                      if position == :before
                                        if scope == :example
                                          @before_example_hooks ||= @filterable_item_repo_class.new(:all?)
                                        else
                            Severity: Minor
                            Found in lib/rspec/core/hooks.rb - About 1 hr to fix

                            Cognitive Complexity

                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                            A method's cognitive complexity is based on a few simple rules:

                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                            • Code is considered more complex for each "break in the linear flow of the code"
                            • Code is considered more complex when "flow breaking structures are nested"

                            Further reading

                            Method add_filter has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.

                                  def add_filter(argv, name, hash)
                                    hash.each_pair do |k, v|
                                      next if CONDITIONAL_FILTERS.include?(k)
                                      tag = name == :inclusion ? k.to_s : "~#{k}".dup
                                      tag << ":#{v}" if v.is_a?(String)
                            Severity: Minor
                            Found in lib/rspec/core/drb.rb - About 1 hr to fix

                            Cognitive Complexity

                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                            A method's cognitive complexity is based on a few simple rules:

                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                            • Code is considered more complex for each "break in the linear flow of the code"
                            • Code is considered more complex when "flow breaking structures are nested"

                            Further reading

                            Method run has 37 lines of code (exceeds 25 allowed). Consider refactoring.

                                  def run(example_group_instance, reporter)
                                    @example_group_instance = example_group_instance
                                    @reporter = reporter
                                    RSpec.configuration.configure_example(self, hooks)
                                    RSpec.current_example = self
                            Severity: Minor
                            Found in lib/rspec/core/example.rb - About 1 hr to fix

                              Method expect_with has 32 lines of code (exceeds 25 allowed). Consider refactoring.

                                    def expect_with(*frameworks)
                                      modules = frameworks.map do |framework|
                                        case framework
                                        when Module
                                          framework
                              Severity: Minor
                              Found in lib/rspec/core/configuration.rb - About 1 hr to fix

                                Method mock_with has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.

                                      def mock_with(framework)
                                        framework_module =
                                          if framework.is_a?(Module)
                                            framework
                                          else
                                Severity: Minor
                                Found in lib/rspec/core/configuration.rb - About 1 hr to fix

                                Cognitive Complexity

                                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                A method's cognitive complexity is based on a few simple rules:

                                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                • Code is considered more complex for each "break in the linear flow of the code"
                                • Code is considered more complex when "flow breaking structures are nested"

                                Further reading

                                Method bisect_over has 31 lines of code (exceeds 25 allowed). Consider refactoring.

                                        def bisect_over(candidate_ids)
                                          return if candidate_ids.one?
                                
                                          notify(
                                            :bisect_round_started,
                                Severity: Minor
                                Found in lib/rspec/core/bisect/example_minimizer.rb - About 1 hr to fix

                                  Method run_benchmarks has 30 lines of code (exceeds 25 allowed). Consider refactoring.

                                    def self.run_benchmarks
                                      Benchmark.ips do |x|
                                        implementations = { :old => "without", :new => "with" }
                                        # Historically, many of our benchmarks have initially been order-sensitive,
                                        # where whichever implementation went first got favored because defining
                                  Severity: Minor
                                  Found in benchmarks/singleton_example_groups/helper.rb - About 1 hr to fix

                                    Method example_failed has 29 lines of code (exceeds 25 allowed). Consider refactoring.

                                            def example_failed(failure)
                                              @failed_examples << failure.example
                                              unless @header_red
                                                @header_red = true
                                                @printer.make_header_red
                                    Severity: Minor
                                    Found in lib/rspec/core/formatters/html_formatter.rb - About 1 hr to fix

                                      Method formatted_cause has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.

                                                def formatted_cause(exception)
                                                  last_cause = final_exception(exception, [exception])
                                                  cause = []
                                      
                                                  if exception.cause
                                      Severity: Minor
                                      Found in lib/rspec/core/formatters/exception_presenter.rb - About 1 hr to fix

                                      Cognitive Complexity

                                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                      A method's cognitive complexity is based on a few simple rules:

                                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                      • Code is considered more complex for each "break in the linear flow of the code"
                                      • Code is considered more complex when "flow breaking structures are nested"

                                      Further reading

                                      Method hooks_for has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.

                                              def hooks_for(position, scope)
                                                if position == :before
                                                  scope == :example ? @before_example_hooks : @before_context_hooks
                                                elsif position == :after
                                                  scope == :example ? @after_example_hooks : @after_context_hooks
                                      Severity: Minor
                                      Found in lib/rspec/core/hooks.rb - About 1 hr to fix

                                      Cognitive Complexity

                                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                      A method's cognitive complexity is based on a few simple rules:

                                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                      • Code is considered more complex for each "break in the linear flow of the code"
                                      • Code is considered more complex when "flow breaking structures are nested"

                                      Further reading

                                      Method run_task has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.

                                            def run_task(verbose)
                                              command = spec_command
                                              puts command if verbose
                                      
                                              if with_clean_environment
                                      Severity: Minor
                                      Found in lib/rspec/core/rake_task.rb - About 1 hr to fix

                                      Cognitive Complexity

                                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                      A method's cognitive complexity is based on a few simple rules:

                                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                      • Code is considered more complex for each "break in the linear flow of the code"
                                      • Code is considered more complex when "flow breaking structures are nested"

                                      Further reading

                                      Method run has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.

                                            def run(example_group_instance, reporter)
                                              @example_group_instance = example_group_instance
                                              @reporter = reporter
                                              RSpec.configuration.configure_example(self, hooks)
                                              RSpec.current_example = self
                                      Severity: Minor
                                      Found in lib/rspec/core/example.rb - About 1 hr to fix

                                      Cognitive Complexity

                                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                      A method's cognitive complexity is based on a few simple rules:

                                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                      • Code is considered more complex for each "break in the linear flow of the code"
                                      • Code is considered more complex when "flow breaking structures are nested"

                                      Further reading

                                      Method define_example_group_method has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.

                                            def self.define_example_group_method(name, metadata={})
                                              idempotently_define_singleton_method(name) do |*args, &example_group_block|
                                                thread_data = RSpec::Support.thread_local_data
                                                top_level   = self == ExampleGroup
                                      
                                      
                                      Severity: Minor
                                      Found in lib/rspec/core/example_group.rb - About 1 hr to fix

                                      Cognitive Complexity

                                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                      A method's cognitive complexity is based on a few simple rules:

                                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                      • Code is considered more complex for each "break in the linear flow of the code"
                                      • Code is considered more complex when "flow breaking structures are nested"

                                      Further reading

                                      Method announce_filters has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.

                                            def announce_filters
                                              fail_if_config_and_cli_options_invalid
                                              filter_announcements = []
                                      
                                              announce_inclusion_filter filter_announcements
                                      Severity: Minor
                                      Found in lib/rspec/core/world.rb - About 1 hr to fix

                                      Cognitive Complexity

                                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                      A method's cognitive complexity is based on a few simple rules:

                                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                      • Code is considered more complex for each "break in the linear flow of the code"
                                      • Code is considered more complex when "flow breaking structures are nested"

                                      Further reading

                                      Method add has 26 lines of code (exceeds 25 allowed). Consider refactoring.

                                          def add(formatter_to_use, *paths)
                                            # If a formatter instance was passed, we can register it directly,
                                            # with no need for any of the further processing that happens below.
                                            if Loader.formatters.key?(formatter_to_use.class)
                                              register formatter_to_use, notifications_for(formatter_to_use.class)
                                      Severity: Minor
                                      Found in lib/rspec/core/formatters.rb - About 1 hr to fix

                                        Method define_example_group_method has 26 lines of code (exceeds 25 allowed). Consider refactoring.

                                              def self.define_example_group_method(name, metadata={})
                                                idempotently_define_singleton_method(name) do |*args, &example_group_block|
                                                  thread_data = RSpec::Support.thread_local_data
                                                  top_level   = self == ExampleGroup
                                        
                                        
                                        Severity: Minor
                                        Found in lib/rspec/core/example_group.rb - About 1 hr to fix

                                          Method expect_with has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.

                                                def expect_with(*frameworks)
                                                  modules = frameworks.map do |framework|
                                                    case framework
                                                    when Module
                                                      framework
                                          Severity: Minor
                                          Found in lib/rspec/core/configuration.rb - About 55 mins to fix

                                          Cognitive Complexity

                                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                          A method's cognitive complexity is based on a few simple rules:

                                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                          • Code is considered more complex for each "break in the linear flow of the code"
                                          • Code is considered more complex when "flow breaking structures are nested"

                                          Further reading

                                          Method get_files_to_run has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.

                                                def get_files_to_run(paths)
                                                  files = FlatMap.flat_map(paths_to_check(paths)) do |path|
                                                    path = path.gsub(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
                                                    File.directory?(path) ? gather_directories(path) : extract_location(path)
                                                  end.uniq
                                          Severity: Minor
                                          Found in lib/rspec/core/configuration.rb - About 55 mins to fix

                                          Cognitive Complexity

                                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                          A method's cognitive complexity is based on a few simple rules:

                                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                          • Code is considered more complex for each "break in the linear flow of the code"
                                          • Code is considered more complex when "flow breaking structures are nested"

                                          Further reading

                                          Method options has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.

                                                def options
                                                  argv = []
                                                  argv << "--color"        if @submitted_options[:color]
                                                  argv << "--force-color"  if @submitted_options[:color_mode] == :on
                                                  argv << "--no-color"     if @submitted_options[:color_mode] == :off
                                          Severity: Minor
                                          Found in lib/rspec/core/drb.rb - About 55 mins to fix

                                          Cognitive Complexity

                                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                          A method's cognitive complexity is based on a few simple rules:

                                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                          • Code is considered more complex for each "break in the linear flow of the code"
                                          • Code is considered more complex when "flow breaking structures are nested"

                                          Further reading

                                          Method backwards_compatibility_default_proc has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.

                                                  def self.backwards_compatibility_default_proc(&example_group_selector)
                                                    Proc.new do |hash, key|
                                                      case key
                                                      when :example_group
                                                        # We commonly get here when rspec-core is applying a previously
                                          Severity: Minor
                                          Found in lib/rspec/core/metadata.rb - About 55 mins to fix

                                          Cognitive Complexity

                                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                          A method's cognitive complexity is based on a few simple rules:

                                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                          • Code is considered more complex for each "break in the linear flow of the code"
                                          • Code is considered more complex when "flow breaking structures are nested"

                                          Further reading

                                          Method custom_formatter has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.

                                              def custom_formatter(formatter_ref)
                                                if Class === formatter_ref
                                                  formatter_ref
                                                elsif string_const?(formatter_ref)
                                                  begin
                                          Severity: Minor
                                          Found in lib/rspec/core/formatters.rb - About 55 mins to fix

                                          Cognitive Complexity

                                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                          A method's cognitive complexity is based on a few simple rules:

                                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                          • Code is considered more complex for each "break in the linear flow of the code"
                                          • Code is considered more complex when "flow breaking structures are nested"

                                          Further reading

                                          Method print_example_failed has 6 arguments (exceeds 4 allowed). Consider refactoring.

                                                  def print_example_failed(pending_fixed, description, run_time, failure_id,
                                                                           exception, extra_content)
                                          Severity: Minor
                                          Found in lib/rspec/core/formatters/html_printer.rb - About 45 mins to fix

                                            Method setup_default has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.

                                                def setup_default(output_stream, deprecation_stream)
                                                  add default_formatter, output_stream if @formatters.empty?
                                            
                                                  unless @formatters.any? { |formatter| DeprecationFormatter === formatter }
                                                    add DeprecationFormatter, deprecation_stream, output_stream
                                            Severity: Minor
                                            Found in lib/rspec/core/formatters.rb - About 45 mins to fix

                                            Cognitive Complexity

                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                            A method's cognitive complexity is based on a few simple rules:

                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                            • Code is considered more complex for each "break in the linear flow of the code"
                                            • Code is considered more complex when "flow breaking structures are nested"

                                            Further reading

                                            Method organize_options has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.

                                                  def organize_options
                                                    @filter_manager_options = []
                                            
                                                    @options = (file_options << command_line_options << env_options).each do |opts|
                                                      @filter_manager_options << [:include, opts.delete(:inclusion_filter)] if opts.key?(:inclusion_filter)
                                            Severity: Minor
                                            Found in lib/rspec/core/configuration_options.rb - About 45 mins to fix

                                            Cognitive Complexity

                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                            A method's cognitive complexity is based on a few simple rules:

                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                            • Code is considered more complex for each "break in the linear flow of the code"
                                            • Code is considered more complex when "flow breaking structures are nested"

                                            Further reading

                                            Method run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.

                                                    def run(position, scope, example_or_group)
                                                      return if RSpec.configuration.dry_run?
                                            
                                                      if scope == :context
                                                        unless example_or_group.class.metadata[:skip]
                                            Severity: Minor
                                            Found in lib/rspec/core/hooks.rb - About 45 mins to fix

                                            Cognitive Complexity

                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                            A method's cognitive complexity is based on a few simple rules:

                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                            • Code is considered more complex for each "break in the linear flow of the code"
                                            • Code is considered more complex when "flow breaking structures are nested"

                                            Further reading

                                            Method apply_derived_metadata_to has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.

                                                  def apply_derived_metadata_to(metadata)
                                                    already_run_blocks = Set.new
                                            
                                                    # We loop and attempt to re-apply metadata blocks to support cascades
                                                    # (e.g. where a derived bit of metadata triggers the application of
                                            Severity: Minor
                                            Found in lib/rspec/core/configuration.rb - About 45 mins to fix

                                            Cognitive Complexity

                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                            A method's cognitive complexity is based on a few simple rules:

                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                            • Code is considered more complex for each "break in the linear flow of the code"
                                            • Code is considered more complex when "flow breaking structures are nested"

                                            Further reading

                                            Method unclosed_tokens_in_line_range has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.

                                                      def unclosed_tokens_in_line_range(line_range)
                                                        tokens = FlatMap.flat_map(line_range) do |line_number|
                                                          source.tokens_by_line_number[line_number]
                                                        end
                                            
                                            
                                            Severity: Minor
                                            Found in lib/rspec/core/formatters/snippet_extractor.rb - About 45 mins to fix

                                            Cognitive Complexity

                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                            A method's cognitive complexity is based on a few simple rules:

                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                            • Code is considered more complex for each "break in the linear flow of the code"
                                            • Code is considered more complex when "flow breaking structures are nested"

                                            Further reading

                                            Method create has 5 arguments (exceeds 4 allowed). Consider refactoring.

                                                    def self.create(parent_group_metadata, user_metadata, example_group_index, *args, &block)
                                            Severity: Minor
                                            Found in lib/rspec/core/metadata.rb - About 35 mins to fix

                                              Method process has 5 arguments (exceeds 4 allowed). Consider refactoring.

                                                      def process(host, parent_groups, globals, position, scope)
                                              Severity: Minor
                                              Found in lib/rspec/core/hooks.rb - About 35 mins to fix

                                                Method subclass has 5 arguments (exceeds 4 allowed). Consider refactoring.

                                                      def self.subclass(parent, description, args, registration_collection, &example_group_block)
                                                Severity: Minor
                                                Found in lib/rspec/core/example_group.rb - About 35 mins to fix

                                                  Method find_and_eval_shared has 5 arguments (exceeds 4 allowed). Consider refactoring.

                                                        def self.find_and_eval_shared(label, name, inclusion_location, *args, &customization_block)
                                                  Severity: Minor
                                                  Found in lib/rspec/core/example_group.rb - About 35 mins to fix

                                                    Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.

                                                            def initialize(metadata, user_metadata, index_provider, description_args, block)
                                                    Severity: Minor
                                                    Found in lib/rspec/core/metadata.rb - About 35 mins to fix

                                                      Method define_mixed_in_module has 5 arguments (exceeds 4 allowed). Consider refactoring.

                                                            def define_mixed_in_module(mod, filters, mod_list, config_method, &block)
                                                      Severity: Minor
                                                      Found in lib/rspec/core/configuration.rb - About 35 mins to fix

                                                        Method create has 5 arguments (exceeds 4 allowed). Consider refactoring.

                                                                def self.create(group_metadata, user_metadata, index_provider, description, block)
                                                        Severity: Minor
                                                        Found in lib/rspec/core/metadata.rb - About 35 mins to fix

                                                          Method run has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.

                                                                def self.run(reporter=RSpec::Core::NullReporter)
                                                                  return if RSpec.world.wants_to_quit
                                                                  reporter.example_group_started(self)
                                                          
                                                                  should_run_context_hooks = descendant_filtered_examples.any?
                                                          Severity: Minor
                                                          Found in lib/rspec/core/example_group.rb - About 35 mins to fix

                                                          Cognitive Complexity

                                                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                          A method's cognitive complexity is based on a few simple rules:

                                                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                          • Code is considered more complex for each "break in the linear flow of the code"
                                                          • Code is considered more complex when "flow breaking structures are nested"

                                                          Further reading

                                                          Severity
                                                          Category