Showing 8 of 8 total issues
File test.py
has 433 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import asyncio
import ipaddress
import socket
import struct
import unittest
Function DnsProxy
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
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,
- 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"
Further reading
Function DnsProxy
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def DnsProxy(
Avoid too many return
statements within this function. Open
Open
return error(query, ERRORS.NXDOMAIN)
Avoid too many return
statements within this function. Open
Open
return error(query, dns_response_code_error.args[0])
Avoid too many return
statements within this function. Open
Open
return Message(
Avoid too many return
statements within this function. Open
Open
return create_task(server_worker(sock, resolve, stop))
Avoid too many return
statements within this function. Open
Open
return start