Showing 4 of 5 total issues
Function _start_server
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def _start_server(self):
soc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
while True:
try:
- 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 _send_message_to_known_peer
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _send_message_to_known_peer(host, port, message, tries):
for i in range(tries):
backoff = int((2 ** i)) - 1
try:
if i > 0 and backoff > 0:
- 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 broadcast_message_to
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def broadcast_message_to(self, message, target_id, reply_to_id=None, nonce=None, ttl=16, noerr=False):
if not self.networking_disabled:
reply_to_id = reply_to_id if reply_to_id else self.node_id
self.broadcast({
- 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 _handle_decrypted_request
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _handle_decrypted_request(self, message, _):
content = json.loads(message['content'])
if not self._nonce_already_consumed(content['nonce']):
if content['type'] == 'heartbeat':
- 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"