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
Class ExampleGroup
has 50 methods (exceeds 20 allowed). Consider refactoring.
class ExampleGroup
extend Hooks
include MemoizedHelpers
extend MemoizedHelpers::ClassMethods
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
- Read upRead up
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 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
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)
Method subclass
has 5 arguments (exceeds 4 allowed). Consider refactoring.
def self.subclass(parent, description, args, registration_collection, &example_group_block)
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?
- Read upRead up
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_examples
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
def self.run_examples(reporter)
ordering_strategy.order(filtered_examples).map do |example|
next if RSpec.world.wants_to_quit
instance = new(example.inspect_output)
set_ivars(instance, before_context_ivars)
- Read upRead up
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"