rspec/rspec-mocks

View on GitHub
lib/rspec/mocks/method_double.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Class MethodDouble has 30 methods (exceeds 20 allowed). Consider refactoring.

    class MethodDouble
      # @private
      attr_reader :method_name, :object, :expectations, :stubs, :method_stasher

      # @private
Severity: Minor
Found in lib/rspec/mocks/method_double.rb - About 3 hrs to fix

    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)
    Severity: Minor
    Found in lib/rspec/mocks/method_double.rb - About 35 mins to fix

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

            def add_stub(error_generator, expectation_ordering, expected_from, opts={}, &implementation)
      Severity: Minor
      Found in lib/rspec/mocks/method_double.rb - About 35 mins to fix

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

              def add_expectation(error_generator, expectation_ordering, expected_from, opts, &implementation)
        Severity: Minor
        Found in lib/rspec/mocks/method_double.rb - About 35 mins to fix

          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.
          Severity: Minor
          Found in lib/rspec/mocks/method_double.rb - About 25 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

          There are no issues that match your filters.

          Category