TracyWebTech/django-revproxy

View on GitHub

Showing 12 of 12 total issues

Function cookie_from_string has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

def cookie_from_string(cookie_string, strict_cookies=False):
    """Parser for HTTP header set-cookie
    The return from this function will be used as parameters for
    django's response.set_cookie method. Because set_cookie doesn't
    have parameter comment, this cookie attribute will be ignored.
Severity: Minor
Found in revproxy/utils.py - About 4 hrs 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 should_transform has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def should_transform(self):
        """Determine if we should transform the response

        :returns:  A boolean value
        """
Severity: Minor
Found in revproxy/transformer.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 get_django_response has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def get_django_response(
    proxy_response, strict_cookies=False, streaming_amount=None
):
    """This method is used to create an appropriate response based on the
    Content-Length of the proxy_response. If the content is bigger than
Severity: Minor
Found in revproxy/response.py - About 55 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

Function set_response_headers has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def set_response_headers(response, response_headers):
    # check for Django 3.2 headers interface
    # https://code.djangoproject.com/ticket/31789
    # check and set pointer before loop to improve efficiency
    if hasattr(response, 'headers'):
Severity: Minor
Found in revproxy/utils.py - About 35 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

Avoid too many return statements within this function.
Open

            return False
Severity: Major
Found in revproxy/transformer.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                return False
    Severity: Major
    Found in revproxy/transformer.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return False
      Severity: Major
      Found in revproxy/transformer.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return True
        Severity: Major
        Found in revproxy/transformer.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return False
          Severity: Major
          Found in revproxy/transformer.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return False
            Severity: Major
            Found in revproxy/transformer.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return cookie_dict
              Severity: Major
              Found in revproxy/utils.py - About 30 mins to fix

                Function asbool has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def asbool(value):
                    """Function used to convert certain string values into an appropriated
                    boolean value.If value is not a string the built-in python
                    bool function will be used to convert the passed parameter
                
                
                Severity: Minor
                Found in revproxy/transformer.py - 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

                Severity
                Category
                Status
                Source
                Language