Showing 114 of 114 total issues
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function submit_bulk_transaction_v1
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def submit_bulk_transaction_v1(bulk_transaction: Sequence[Dict[str, Any]], api_key: "api_key_model.APIKeyModel") -> Dict[str, List[Any]]:
"""
Formats, validates and enqueues the transactions in
the payload of bulk_transaction
Returns dictionary of 2 lists, key "201" are successfully created txn ids and key "400" are transactions that failed to post (entire dto passed in from user)
- 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 query_blocks_v1
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def query_blocks_v1(params: Dict[str, Any], parse: bool = False) -> "RSearch":
"""Returns block matching block id, with query parameters accepted.
Args:
block_id: string Block id to search for.
params: Dictionary of redisearch query options
- 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
if watch_block and int(txn_model.block_id) >= watch_block:
txn_model.extract_custom_indexes(txn_type_models[txn_model.txn_type])
put_document(txn_model.txn_type, txn_model.txn_id, txn_model.export_as_search_index(), upsert=True)
client.redis.sadd(TXN_MIGRATION_KEY, txn_path)
Function initialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(
Avoid deeply nested control flow statements. Open
if isinstance(index_item, str):
transaction_index_object[field_name] = index_item
else:
_log.warning(f"Provided value {index_item} for field {field_name} was not a string. Can't index")
# Check that the item we extracted is (or converts to) a valid number for number type custom indexes
Function create_block
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_block(
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, name: str, testnet: bool, node_url: str, rpc_port: int, api_port: int, b64_private_key: str):
Function attempt_job_launch
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def attempt_job_launch(event: dict, retry: int = 0) -> None:
"""Launch kubernetes namespaced job given a smart contract invocation
Args:
event: An invocation of a smart contract
retry: The retry count for recursive invocation (dont specify manually)
- 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 zadd_sync
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def zadd_sync(name: str, mapping: Dict[str, int], nx: bool = False, xx: bool = False, ch: bool = False, incr: bool = False) -> int:
Function hash_l4_block
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def hash_l4_block(hash_type: SupportedHashes, block: "l4_block_model.L4BlockModel", nonce: int = 0) -> bytes:
"""Hash an l4 block
Args:
hash_type: SupportedHashes enum type
block: L4BlockModel with appropriate data to hash
- 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
Consider simplifying this complex logical expression. Open
if (not cron and not seconds) or (cron and seconds) or not execution_order or not txn_type:
raise exceptions.TimingEventSchedulerError("BAD_REQUEST")
if cron:
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function add_receipt
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_receipt(l1_block_id: str, level: int, dc_id: str, block_id: str, proof: str) -> None:
Function put_document
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def put_document(index: str, doc_name: str, fields: Dict[str, Any], upsert: bool = False, partial_update: bool = False) -> None:
Function make_matchmaking_request
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def make_matchmaking_request(
Function is_key_allowed
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def is_key_allowed(
Function check_generic_signature
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def check_generic_signature(
Function generate_authenticated_request
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def generate_authenticated_request(
Function verify_block
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def verify_block(