ErrorGenerator has 48 methods (exceeds 20 allowed). Consider refactoring.
class ErrorGenerator attr_writer :opts def initialize(target=nil) @target = target
error_generator.rb has 262 lines of code (exceeds 250 allowed). Consider refactoring.
RSpec::Support.require_rspec_support "object_formatter" module RSpec module Mocks # Raised when a message expectation is not satisfied.
raise_expectation_error has 8 arguments (exceeds 4 allowed). Consider refactoring.
def raise_expectation_error(message, expected_received_count, argument_list_matcher, actual_received_count, expectation_count_type, args, backtrace_line=nil, source_id=nil)
describe_expectation has 5 arguments (exceeds 4 allowed). Consider refactoring.
def describe_expectation(verb, message, expected_received_count, _actual_received_count, args)
raise_unimplemented_error has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
def raise_unimplemented_error(doubled_module, method_name, object) message = case object when InstanceVerifyingDouble "the %s class does not implement the instance method: %s".dup << if ObjectMethodReference.for(doubled_module, method_name).implemented?
- Read upRead up
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"