lib/rspec/mocks/method_double.rb
Class MethodDouble
has 30 methods (exceeds 20 allowed). Consider refactoring.
class MethodDouble
# @private
attr_reader :method_name, :object, :expectations, :stubs, :method_stasher
# @private
Method setup_simple_method_double
has 5 arguments (exceeds 4 allowed). Consider refactoring.
def setup_simple_method_double(method_name, response, collection, error_generator=nil, backtrace_line=nil)
Method add_stub
has 5 arguments (exceeds 4 allowed). Consider refactoring.
def add_stub(error_generator, expectation_ordering, expected_from, opts={}, &implementation)
Method add_expectation
has 5 arguments (exceeds 4 allowed). Consider refactoring.
def add_expectation(error_generator, expectation_ordering, expected_from, opts, &implementation)
Method usable_rspec_prepended_module
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
def usable_rspec_prepended_module
@proxy.prepended_modules_of_singleton_class.each do |mod|
# If we have one of our modules prepended before one of the user's
# modules that defines the method, use that, since our module's
# definition will take precedence.
- 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"