src/pook/mock.py

Summary

Maintainability
D
2 days
Test Coverage

File mock.py has 673 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import functools
from furl import furl
from inspect import isfunction, ismethod

from .response import Response
Severity: Major
Found in src/pook/mock.py - About 1 day to fix

    Mock has 42 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Mock(object):
        """
        Mock is used to declare and compose the HTTP request/response mock
        definition and matching expectations, which provides fluent API DSL.
    
    
    Severity: Minor
    Found in src/pook/mock.py - About 5 hrs to fix

      Function match has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def match(self, request):
              """
              Matches an outgoing HTTP request against the current mock matchers.
      
              This method acts like a delegator to `pook.MatcherEngine`.
      Severity: Minor
      Found in src/pook/mock.py - About 1 hr 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

      Function __call__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def __call__(self, fn):
              """
              Overload Mock instance as callable object in order to be used
              as decorator definition syntax.
      
      
      Severity: Minor
      Found in src/pook/mock.py - About 45 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
      Status