xeroc/python-graphenelib

View on GitHub

Showing 82 of 136 total issues

AbstractGrapheneChain has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

class AbstractGrapheneChain:
    def define_classes(self):
        raise NotImplementedError

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

    Price has 23 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Price(dict, AbstractBlockchainInstanceProvider):
        """This class deals with all sorts of prices of any pair of assets to
        simplify dealing with the tuple::
    
            (quote, base)
    Severity: Minor
    Found in graphenecommon/price.py - About 2 hrs to fix

      Function _fetchkeys has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def _fetchkeys(self, account, perm, level=0, required_treshold=1):
      
              # Do not travel recursion more than 2 levels
              if level > 2:
                  return []
      Severity: Minor
      Found in graphenecommon/transactionbuilder.py - About 2 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

      Function appendSigner has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def appendSigner(self, accounts, permission):
              """Try to obtain the wif key from the wallet by telling which account
              and permission is supposed to sign the transaction
      
              :param str,list,tuple,set accounts: accounts to sign transaction with
      Severity: Minor
      Found in graphenecommon/transactionbuilder.py - About 2 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 chain.py has 257 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      import logging
      from graphenestorage import SqliteConfigurationStore
      
      log = logging.getLogger(__name__)
      Severity: Minor
      Found in graphenecommon/chain.py - About 2 hrs to fix

        File ecdsa.py has 255 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        from __future__ import absolute_import
        
        import time
        import ecdsa
        Severity: Minor
        Found in graphenebase/ecdsa.py - About 2 hrs to fix

          File message.py has 254 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # -*- coding: utf-8 -*-
          import json
          import logging
          import re
          import inspect
          Severity: Minor
          Found in graphenecommon/aio/message.py - About 2 hrs to fix

            Function getChainParams has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                def getChainParams(self, chain):
                    # chain may be an identifier, the chainid, or the prefix
                    # ultimately, we need to be able to identify the chain id
                    def find_in_known_chains(identifier):
                        chains = self.getKnownChains()
            Severity: Minor
            Found in graphenebase/signedtransactions.py - About 2 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

            Function parse_response has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                def parse_response(self, query, log_on_debug=True):
                    ret = {}
                    if isinstance(query, dict):
                        ret = query
                    else:
            Severity: Minor
            Found in grapheneapi/rpc.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 refresh has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                def refresh(self):
                    """Refresh/Obtain an account's data from the API server"""
                    import re
            
                    if re.match(r"^1\.2\.[0-9]*$", self.identifier):
            Severity: Minor
            Found in graphenecommon/account.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 __getattr__ has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                def __getattr__(self, name):
                    """Proxies RPC calls to actual Websocket or Http instance.
            
                    Connection-related errors catched here and handled.
                    """
            Severity: Minor
            Found in grapheneapi/api.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 __getattr__ has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                def __getattr__(self, name):
                    """Map all methods to RPC calls and pass through the arguments"""
            
                    def method(*args, **kwargs):
            
            
            Severity: Minor
            Found in grapheneapi/rpc.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 __init__ has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                def __init__(self, *args, **kwargs):
                    self.define_classes()
                    assert self.asset_class
                    assert self.price_class
            
            
            Severity: Minor
            Found in graphenecommon/amount.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 constructTx has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                def constructTx(self):
                    """Construct the actual transaction and store it in the class's dict
                    store
                    """
                    ops = list()
            Severity: Minor
            Found in graphenecommon/transactionbuilder.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 unicodify has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

            def unicodify(data):
                r = []
                for s in data:
                    o = ord(s)
                    if (o <= 7) or (o == 11) or (o > 13 and o < 32):
            Severity: Minor
            Found in graphenebase/utils.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 finalizeOp has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                def finalizeOp(self, ops, account, permission, **kwargs):
                    """This method obtains the required private keys if present in
                    the wallet, finalizes the transaction, signs it and
                    broadacasts it
            
            
            Severity: Minor
            Found in graphenecommon/chain.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 blocks has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def blocks(self, start=None, stop=None):
                    """Yields blocks starting from ``start``.
            
                    :param int start: Starting block
                    :param int stop: Stop at this block
            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 rpcexec has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def rpcexec(self, payload):
                    """Manual execute a command on API (internally used)
            
                    param str payload: The payload containing the request
                    return: Servers answer to the query
            Severity: Minor
            Found in grapheneapi/grapheneapi.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 __mul__ has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def __mul__(self, other):
                    a = self.copy()
                    if isinstance(other, Price):
                        # Rotate/invert other
                        if (
            Severity: Minor
            Found in graphenecommon/price.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 __getattr__ has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def __getattr__(self, name):
                    """Map all methods to RPC calls and pass through the arguments
            
                    This method is actually defined in RPC class, but we need to
                    overwrite this here so that we can use async/await.
            Severity: Minor
            Found in grapheneapi/aio/rpc.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

            Severity
            Category
            Status
            Source
            Language