Showing 7 of 24 total issues
File client.py
has 685 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import datetime
import io
import logging
import os
import tempfile
File communicator.py
has 336 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import logging
import queue
import time
import typing as tp
Function __init__
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def __init__(self, cert: tp.Union[str, io.StringIO],
priv_key: tp.Union[str, io.StringIO],
evt_database: tp.Union[str, BaseEventDatabase],
pp_database: tp.Optional[BasePathpointDatabase] = None,
macro_database: tp.Optional[BaseMacroDatabase] = None,
Function __init__
has 23 arguments (exceeds 15 allowed). Consider refactoring. Open
Open
def __init__(self, cert: tp.Union[str, io.StringIO],
Function process_orders
has a Cognitive Complexity of 56 (exceeds 50 allowed). Consider refactoring. Open
Open
def process_orders(self, orders) -> tp.List[Order]:
"""
Do some orders and return those that need to be retried
"""
futures_to_complete = []
- 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
Avoid deeply nested control flow statements. Open
Open
if not isinstance(fut, Future):
if fut is not None:
pathpoint.set_new_value(time_ms(), fut)
else:
fut.add_done_callback(on_read_completed_factory(pathpoint))
Avoid too many return
statements within this function. Open
Open
return {}