xeroc/python-graphenelib

View on GitHub

Showing 82 of 136 total issues

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

    def history(self, first=0, last=0, limit=-1, only_ops=[], exclude_ops=[]):
Severity: Minor
Found in graphenecommon/account.py - About 35 mins to fix

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

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

      Function list_operations has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def list_operations(self):
              ret = list()
              for o in self.ops:
                  if isinstance(o, ProposalBuilder):
                      prop = o.get_raw()
      Severity: Minor
      Found in graphenecommon/transactionbuilder.py - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def __init__(self, data, prefix=None):
              self.set_prefix(prefix)
              if isinstance(data, Base58):
                  data = repr(data)
              if all(c in string.hexdigits for c in data):
      Severity: Minor
      Found in graphenebase/base58.py - About 35 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 new_proposal has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def new_proposal(
              self,
              parent=None,
              proposer=None,
              proposal_expiration=None,
      Severity: Minor
      Found in graphenecommon/chain.py - About 35 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 wait_for_and_get_block has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def wait_for_and_get_block(self, block_number, blocks_waiting_for=None):
              """Get the desired block from the chain, if the current head block is
              smaller (for both head and irreversible) then we wait, but a
              maxmimum of blocks_waiting_for * max_block_wait_repetition time
              before failure.
      Severity: Minor
      Found in graphenecommon/blockchain.py - About 35 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 connect has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def connect(self, node="", rpcuser="", rpcpassword="", **kwargs):
              """Connect to blockchain network (internal use only)"""
              if not node:
                  if "node" in self.config:
                      node = self.config["node"]
      Severity: Minor
      Found in graphenecommon/chain.py - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def verify(self, **kwargs):
              """Verify a message with an account's memo key
      
              :param str account: (optional) the account that owns the bet
                  (defaults to ``default_account``)
      Severity: Minor
      Found in graphenecommon/message.py - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def __init__(self, *args, **kwargs):
      
              if len(args) == 1 and isinstance(args[0], self.__class__):
                  # In this case, there is only one argument which is already an
                  # instance of a class that inherits Graphene Object, hence, we copy
      Severity: Minor
      Found in graphenebase/objects.py - About 35 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 getKeyType has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def getKeyType(self, account, pub):
              """Get key type"""
              for authority in ["owner", "active"]:
                  for key in account[authority]["key_auths"]:
                      if str(pub) == key[0]:
      Severity: Minor
      Found in graphenecommon/wallet.py - About 35 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_message has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def verify_message(message, signature, hashfn=hashlib.sha256):
          if not isinstance(message, bytes):
              message = bytes(message, "utf-8")
          if not isinstance(signature, bytes):  # pragma: no cover
              signature = bytes(signature, "utf-8")
      Severity: Minor
      Found in graphenebase/ecdsa.py - About 35 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 add_required_fees has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def add_required_fees(self, ops, asset_id="1.3.0"):
              """Auxiliary method to obtain the required fees for a set of
              operations. Requires a websocket connection to a witness node!
              """
              ws = self.blockchain.rpc
      Severity: Minor
      Found in graphenecommon/transactionbuilder.py - About 35 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 refresh has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def refresh(self):
              if self.test_valid_objectid(self.identifier):
                  _, i, _ = self.identifier.split(".")
                  if int(i) == 2:
                      account = self.account_class(
      Severity: Minor
      Found in graphenecommon/committee.py - About 35 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

      Avoid too many return statements within this function.
      Open

              return x ^ (y | ~z)
      Severity: Major
      Found in graphenebase/ripemd160.py - About 30 mins to fix

        Function addSigningInformation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def addSigningInformation(self, account, permission):
                """This is a private method that adds side information to a
                unsigned/partial transaction in order to simplify later
                signing (e.g. for multisig or coldstorage)
        
        
        Severity: Minor
        Found in graphenecommon/transactionbuilder.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

        Function claimable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def claimable(self):
                if self["policy"][0] == 1:
                    p = self["policy"][1]
                    ratio = (
                        (
        Severity: Minor
        Found in graphenecommon/vesting.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

        Function setup_proxy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def setup_proxy(self, options):
                proxy_url = options.pop("proxy", None)
                if proxy_url:  # pragma: no cover
                    url = urllib.parse.urlparse(proxy_url)
                    self.proxy_host = url.hostname
        Severity: Minor
        Found in grapheneapi/rpc.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

        Function ops has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def ops(self, start=None, stop=None, **kwargs):
                """Yields all operations (excluding virtual operations) starting from
                ``start``.
        
                :param int start: Starting block
        Severity: Minor
        Found in graphenecommon/blockchain.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

        Function refresh has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def refresh(self):
                if self.test_valid_objectid(self.identifier):
                    _, i, _ = self.identifier.split(".")
                    if int(i) == 6:
                        witness = self.blockchain.rpc.get_object(self.identifier)
        Severity: Minor
        Found in graphenecommon/witness.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

        Function broadcast has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def broadcast(self):
                """Broadcast a transaction to the blockchain network
        
                :param tx tx: Signed transaction to broadcast
                """
        Severity: Minor
        Found in graphenecommon/transactionbuilder.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

        Severity
        Category
        Status
        Source
        Language