dragonchain/lib/dto/bnb.py
Function new_from_user_input
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
Open
def new_from_user_input(user_input: Dict[str, Any]) -> "BinanceNetwork": # noqa: C901
"""Create a new BinanceNetwork model from user input
Args:
user_input: User dictionary input (assumed already passing create_binance_interchain_schema)
Returns:
- 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
File bnb.py
has 334 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
# Copyright 2020 Dragonchain, Inc.
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Trademarks. is deleted and replaced with:
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(self, name: str, testnet: bool, node_url: str, rpc_port: int, api_port: int, b64_private_key: str):
Function get_transaction_fee_estimate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def get_transaction_fee_estimate(self) -> int:
"""Calculate the transaction fee estimate for a transaction given current fee rates
Returns:
The amount of estimated transaction fee cost for the network
"""
- 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"