uktrade/dns-rewrite-proxy

View on GitHub

Showing 8 of 8 total issues

File test.py has 433 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import asyncio
import ipaddress
import socket
import struct
import unittest
Severity: Minor
Found in test.py - About 6 hrs to fix

    Function DnsProxy has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def DnsProxy(
            get_resolver=get_resolver_default,
            get_logger_adapter=get_logger_adapter_default,
            get_resolver_logger_adapter=get_resolver_logger_adapter_default,
            get_socket=get_socket_default, num_workers=1000,
    Severity: Minor
    Found in dnsrewriteproxy.py - About 2 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 DnsProxy has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def DnsProxy(
    Severity: Minor
    Found in dnsrewriteproxy.py - About 45 mins to fix

      Avoid too many return statements within this function.
      Open

                  return error(query, ERRORS.NXDOMAIN)
      Severity: Major
      Found in dnsrewriteproxy.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return error(query, dns_response_code_error.args[0])
        Severity: Major
        Found in dnsrewriteproxy.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return Message(
          Severity: Major
          Found in dnsrewriteproxy.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return create_task(server_worker(sock, resolve, stop))
            Severity: Major
            Found in dnsrewriteproxy.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  return start
              Severity: Major
              Found in dnsrewriteproxy.py - About 30 mins to fix
                Severity
                Category
                Status
                Source
                Language