Showing 16 of 16 total issues
File client.py
has 291 lines of code (exceeds 250 allowed). Consider refactoring. Open
import asyncio
import logging
import threading
from typing import Any, Dict, Optional, Tuple, Type, TypeVar, Union
Function handle_msg
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def handle_msg(self, rpc, msg):
if rpc == "get_rpc_contract":
return self.generate_rpc_contract(msg)
if rpc == "connect":
- 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 generate_client_code_and_save
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def generate_client_code_and_save(host, port, directory, overwrite_dir=False):
zero_client = ZeroClient(host, port)
code = zero_client.call("get_rpc_contract", [host, port])
if isinstance(code, dict) and "__zerror__failed_to_generate_client_code" in code:
- 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 __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, id, items, created_by, created_at, status, updated_at=None):
Avoid deeply nested control flow statements. Open
if not data:
break
data = msgpack.unpackb(data)
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, id, items, created_by, created_at, status, updated_at=None):
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, id, items, created_by, created_at, status, updated_at=None):
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, id, items, created_by, created_at, status, updated_at=None):
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, id, items, created_by, created_at, status, updated_at=None):
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, id, items, created_by, created_at, status, updated_at=None):
Function spawn_worker
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def spawn_worker(
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function run
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def run(self):
processes = []
try:
processes = [
Process(
- 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 verify_incoming_rpc_call_input_type
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def verify_incoming_rpc_call_input_type(
msg, rpc_method: str, rpc_input_type_map: dict
): # pragma: no cover
input_type = rpc_input_type_map[rpc_method]
if input_type is None:
- 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 call
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def call(
self,
rpc_func_name: str,
msg: Union[int, float, str, dict, list, tuple, None],
timeout: Optional[int] = None,
- 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 verify_function_input_type
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def verify_function_input_type(func: Callable):
input_type = get_function_input_class(func)
if input_type in allowed_types:
return
- 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"