xeroc/python-graphenelib

View on GitHub

Showing 82 of 136 total issues

Function get_all_accounts has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def get_all_accounts(self, start="", stop="", steps=1e3, **kwargs):
        """Yields account names between start and stop.

        :param str start: Start at this account name
        :param str stop: Stop at this account name
Severity: Minor
Found in graphenecommon/blockchain.py - About 1 hr 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

Function __json__ has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def __json__(self):
        if len(self) == 0:
            return {}
        d = {}  # JSON output is *not* ordered
        for name, value in self.items():
Severity: Minor
Found in graphenebase/objects.py - About 1 hr 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

Function decrypt has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def decrypt(encrypted_privkey, passphrase):
    """BIP0038 non-ec-multiply decryption. Returns WIF privkey.

    :param Base58 encrypted_privkey: Private key
    :param str passphrase: UTF-8 encoded passphrase for decryption
Severity: Minor
Found in graphenebase/bip38.py - About 1 hr to fix

    Function __getattr__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def __getattr__(self, name):
            async def func(*args, **kwargs):
                while True:
                    try:
                        func = self.connection.__getattr__(name)
    Severity: Minor
    Found in grapheneapi/aio/api.py - About 55 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

    Function verify has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def verify(self, pubkeys=[], chain=None):
            if not chain:
                chain = self.get_default_prefix()
    
            chain_params = self.getChainParams(chain)
    Severity: Minor
    Found in graphenebase/signedtransactions.py - About 45 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

    Function claim has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def claim(self, account=None, **kwargs):
            """Claim a balance from the genesis block
    
            :param str balance_id: The identifier that identifies the balance
                to claim (1.15.x)
    Severity: Minor
    Found in graphenecommon/genesisbalance.py - About 45 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

    Function recover_public_key has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def recover_public_key(digest, signature, i, message=None):
        """Recover the public key from the the signature"""
    
        # See http: //www.secg.org/download/aid-780/sec1-v2.pdf section 4.1.6 primarily
        curve = ecdsa.SECP256k1.curve
    Severity: Minor
    Found in graphenebase/ecdsa.py - About 45 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

    Function __div__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def __div__(self, other):
            a = self.copy()
            if isinstance(other, Price):
                # Rotate/invert other
                if sorted(self.symbols()) == sorted(other.symbols()):
    Severity: Minor
    Found in graphenecommon/price.py - About 45 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

    Function __init__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self, *args, **kwargs):
            Caching.__init__(self, *args, **kwargs)
            # Some lists are specific to some key value that is then provided as
            # first argument
            if len(args) > 0 and isinstance(args[0], str):
    Severity: Minor
    Found in graphenecommon/blockchainobject.py - About 45 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

    Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(
    Severity: Minor
    Found in graphenecommon/transactionbuilder.py - About 45 mins to fix

      Function find_next has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def find_next(self):
              """Find the next url in the list"""
              if int(self.num_retries) < 0:  # pragma: no cover
                  self._cnt_retries += 1
                  sleeptime = (self._cnt_retries - 1) * 2 if self._cnt_retries < 10 else 10
      Severity: Minor
      Found in grapheneapi/api.py - About 45 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

      Function __init__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def __init__(self, op, **kwargs):
              list.__init__(self, [0, GrapheneObject()])
      
              # Are we dealing with an actual operation as list of opid and payload?
              if isinstance(op, list) and len(op) == 2:
      Severity: Minor
      Found in graphenebase/objects.py - About 45 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

      Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(
      Severity: Minor
      Found in graphenecommon/chain.py - About 45 mins to fix

        Function compress has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def compress(h0, h1, h2, h3, h4, block):
        Severity: Minor
        Found in graphenebase/ripemd160.py - About 45 mins to fix

          Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(
          Severity: Minor
          Found in graphenecommon/price.py - About 45 mins to fix

            Function _store_items has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def _store_items(self, key=None):
                    key = key or self.__class__.__name__
                    if key in self._cache:
                        # check for duplicates. race condition when loading might cause that store_items is called twice with same list
                        toadd = []
            Severity: Minor
            Found in graphenecommon/blockchainobject.py - About 45 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

            Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(self, data, klass=None, lazy=False, use_cache=True, *args, **kwargs):
            Severity: Minor
            Found in graphenecommon/blockchainobject.py - About 45 mins to fix

              Function awaitTxConfirmation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def awaitTxConfirmation(self, transaction, limit=10):
                      """Returns the transaction as seen by the blockchain after being
                      included into a block
              
                      .. note:: If you want instant confirmation, you need to instantiate
              Severity: Minor
              Found in graphenecommon/blockchain.py - About 45 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

              Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(
              Severity: Minor
              Found in graphenecommon/blockchain.py - About 35 mins to fix

                Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def __init__(self, urls, user=None, password=None, connect=True, **kwargs):
                Severity: Minor
                Found in grapheneapi/api.py - About 35 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language