Showing 41 of 41 total issues
Class DoubleDefinition
has 40 methods (exceeds 20 allowed). Consider refactoring. Open
class DoubleDefinition #:nodoc:
ORIGINAL_METHOD = Object.new
attr_accessor(
:argument_expectation,
Method wildcard_match?
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
def wildcard_match?(other)
return false unless other.is_a?(Hash)
return false if size != other.size
- 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
Class Double
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class Double
extend(Module.new do
def formatted_name(method_name, args, kwargs)
formatted_arguments =
args.collect {|arg| arg.inspect} +
Class DoubleInjection
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class DoubleInjection < Injection
extend(Module.new do
def find_or_create(subject_class, method_name)
instances[subject_class][method_name.to_sym] ||= begin
new(subject_class, method_name.to_sym).bind
Method find_all_matches
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def find_all_matches(args, kwargs)
kwargs ||= {}
@doubles.each do |double|
if double.exact_match?(args, kwargs)
matching_doubles << double
- 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 wildcard_match?
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def wildcard_match?(arguments, keyword_arguments)
return false unless arguments.length == expected_arguments.length
arguments.each_with_index do |arg, index|
expected_argument = expected_arguments[index]
if expected_argument.respond_to?(:wildcard_match?)
- 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 hook
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def hook
assertion_error_class = self.assertion_error_class
test_case_class.class_eval do
include RR::DSL
include Mixin
- 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 bind_method
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def bind_method
id = BoundObjects.size
BoundObjects[id] = subject_class
if KeywordArguments.fully_supported?
Method wildcard_match?
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def wildcard_match?(other)
return false unless other.is_a?(Array)
return false unless size == other.size
each_with_index do |value, i|
- 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 bind_method
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def bind_method
id = BoundObjects.size
BoundObjects[id] = subject_class
if KeywordArguments.fully_supported?
Method hook
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def hook
assertion_error_class = self.assertion_error_class
test_case_class.class_eval do
include RR::DSL
include Mixin
Method wildcard_match?
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def wildcard_match?(other)
if is_a?(String)
return RR::Expectations::ArgumentEqualityExpectation.recursive_safe_eq(self, other)
end
return false unless other.is_a?(Enumerable)
- 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 call
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def call(subject_class, stubbed_methods=nil, &block)
strategy_lambda = lambda do |double_definition_create|
::RR::DoubleDefinitions::Strategies::DoubleInjection::AnyInstanceOf.new(double_definition_create)
end
::RR::DoubleDefinitions::DoubleDefinitionCreate.set_default_double_injection_strategy(strategy_lambda) do
- 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 wildcard_match?
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def wildcard_match?(arguments, keyword_arguments)
return false unless arguments.length == expected_arguments.length
arguments.each_with_index do |arg, index|
expected_argument = expected_arguments[index]
if expected_argument.respond_to?(:wildcard_match?)
Method wildcard_match?
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def wildcard_match?(other)
return false unless other.is_a?(Hash)
return false if size != other.size
Method exact_match?
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def exact_match?(arguments, keyword_arguments)
return false unless arguments.length == expected_arguments.length
arguments.each_with_index do |arg, index|
expected_arg = expected_arguments[index]
return false unless self.class.recursive_safe_eq(expected_arg, arg)
- 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 find_double_to_attempt
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def find_double_to_attempt
matches = DoubleMatches.new(doubles).find_all_matches(args, kwargs)
unless matches.exact_terminal_doubles_to_attempt.empty?
return matches.exact_terminal_doubles_to_attempt.first
- 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 call
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def call
if Injections::DoubleInjection.exists?(subject_class, method_name)
@double = find_double_to_attempt
if double
return_value = extract_subject_from_return_value(call_implementation)
- 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 dispatch_method
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def dispatch_method(subject,
subject_class,
method_name,
arguments,
keyword_arguments,
Method bind
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def bind
unless class_instance_method_defined(subject_class, original_method_alias_name)
unless class_instance_method_defined(subject_class, :method_missing)
@placeholder_method_defined = true
subject_class.class_eval do
- 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"