dragonchain/dragonchain

View on GitHub
dragonchain/lib/dto/bnb.py

Summary

Maintainability
C
1 day
Test Coverage
A
96%

Function new_from_user_input has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
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:
Severity: Minor
Found in dragonchain/lib/dto/bnb.py - About 5 hrs to fix

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

# 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:
Severity: Minor
Found in dragonchain/lib/dto/bnb.py - About 4 hrs to fix

    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):
    Severity: Minor
    Found in dragonchain/lib/dto/bnb.py - About 45 mins to fix

      Function get_transaction_fee_estimate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      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
              """
      Severity: Minor
      Found in dragonchain/lib/dto/bnb.py - About 25 mins to fix

      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

      There are no issues that match your filters.

      Category
      Status