holgern/beem

View on GitHub

Showing 683 of 2,332 total issues

Function keygen has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring.
Open

def keygen(import_word_list, strength, passphrase, path, network, role, account_keys, sequence, account, wif, export_pub, export):
    """ Creates a new random BIP39 key and prints its derived private key and public key.
        The generated key is not stored. Can also be used to create new keys for an account.
        Can also be used to derive account keys from a password or BIP39 wordlist.
    """
Severity: Minor
Found in beem/cli.py - About 1 day 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

BlockChainInstance has 76 functions (exceeds 20 allowed). Consider refactoring.
Open

class BlockChainInstance(object):
    """ Connect to a Graphene network.

        :param str node: Node to connect to *(optional)*
        :param str rpcuser: RPC user *(optional)*
Severity: Major
Found in beem/blockchaininstance.py - About 1 day to fix

    Function refresh_data has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring.
    Open

        def refresh_data(self, chain_property, force_refresh=False, data_refresh_time_seconds=None):
            """ Read and stores steem blockchain parameters
                If the last data refresh is older than data_refresh_time_seconds, data will be refreshed
    
                :param bool force_refresh: if True, a refresh of the data is enforced
    Severity: Minor
    Found in beem/blockchaininstance.py - About 1 day 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 download has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring.
    Open

    def download(permlink, account, save, export):
        """Download body with yaml header"""
        stm = shared_blockchain_instance()
        if stm.rpc is not None:
            stm.rpc.rpcconnect()
    Severity: Minor
    Found in beem/cli.py - About 1 day 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

    Consider simplifying this complex logical expression.
    Open

            if amount and asset is None and isinstance(amount, Amount):
                # Copy Asset object
                self["amount"] = amount["amount"]
                self["symbol"] = amount["symbol"]
                self["asset"] = amount["asset"]
    Severity: Critical
    Found in beem/amount.py - About 1 day to fix

      Function vote has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
      Open

          def vote(self, vote_event):
              def process_vote_content(event):
                  start_rshares = 0.0
                  for vote in event["active_votes"]:
                      if vote["voter"] == vote_event["voter"] and float(vote["rshares"]) < 0:
      Severity: Minor
      Found in examples/watching_the_watchers.py - About 1 day 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 62 (exceeds 5 allowed). Consider refactoring.
      Open

          def appendSigner(self, account, permission):
              """ Try to obtain the wif key from the wallet by telling which account
                  and permission is supposed to sign the transaction
                  It is possible to add more than one signer.
      
      
      Severity: Minor
      Found in beem/transactionbuilder.py - About 1 day 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 snapshot.py has 555 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      import pytz
      import json
      import re
      from datetime import datetime, timedelta, date, time
      Severity: Major
      Found in beem/snapshot.py - About 1 day to fix

        Function post has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
        Open

            def post(self,
                     title,
                     body,
                     author=None,
                     permlink=None,
        Severity: Minor
        Found in beem/blockchaininstance.py - About 1 day 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 55 (exceeds 5 allowed). Consider refactoring.
        Open

            def __init__(self, d, prefix=default_prefix, json_str=False):
                self.json_str = json_str
                if isinstance(d, string_types):
                    self.amount, self.symbol = d.strip().split(" ")
                    self.precision = None
        Severity: Minor
        Found in beembase/objects.py - About 1 day 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 update_nodes has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
        Open

            def update_nodes(self, weights=None, blockchain_instance=None, **kwargs):
                """ Reads metadata from fullnodeupdate and recalculates the nodes score
        
                    :param list/dict weight: can be used to weight the different benchmarks
                    :type weight: list, dict
        Severity: Minor
        Found in beem/nodelist.py - About 1 day 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 unlock_wallet has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
        Open

        def unlock_wallet(stm, password=None, allow_wif=True):
            if stm.unsigned and stm.nobroadcast:
                return True
            if stm.use_ledger:
                return True
        Severity: Minor
        Found in beem/cli.py - About 1 day 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 55 (exceeds 5 allowed). Consider refactoring.
        Open

            def rpcexec(self, payload):
                """
                Execute a call by sending the payload.
        
                :param json payload: Payload data
        Severity: Minor
        Found in beemapi/graphenerpc.py - About 1 day 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 transactionbuilder.py has 507 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        import logging
        import struct
        #import time (not currently used)
        from datetime import timedelta
        Severity: Major
        Found in beem/transactionbuilder.py - About 1 day to fix

          Function rpcconnect has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
          Open

              def rpcconnect(self, next_url=True):
                  """Connect to next url in a loop."""
                  if self.nodes.working_nodes_count == 0:
                      return
                  while True:
          Severity: Minor
          Found in beemapi/graphenerpc.py - About 7 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 graphenerpc.py has 472 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # -*- coding: utf-8 -*-
          from itertools import cycle
          import threading
          import sys
          import json
          Severity: Minor
          Found in beemapi/graphenerpc.py - About 7 hrs to fix

            Function build_vp_arrays has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
            Open

                def build_vp_arrays(self):
                    """ Build vote power arrays"""
                    self.vp_timestamp = [self.timestamps[1]]
                    self.vp = [STEEM_100_PERCENT]
                    HF_21 = datetime(2019, 8, 27, 15, tzinfo=pytz.utc)
            Severity: Minor
            Found in beem/snapshot.py - About 7 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 witness.py has 460 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # -*- coding: utf-8 -*-
            import json
            from beem.instance import shared_blockchain_instance
            from beemgraphenebase.py23 import bytes_types, integer_types, string_types, text_type
            from .account import Account
            Severity: Minor
            Found in beem/witness.py - About 7 hrs to fix

              Function decrypt has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
              Open

              def decrypt(memo, account, output, info, text, binary):
                  """decrypt a (or more than one) decrypted memo/file with your memo key
              
                  """
                  if text and binary:
              Severity: Minor
              Found in beem/cli.py - About 6 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 price.py has 441 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # -*- coding: utf-8 -*-
              from beemgraphenebase.py23 import bytes_types, integer_types, string_types, text_type
              from fractions import Fraction
              from beem.instance import shared_blockchain_instance
              from .exceptions import InvalidAssetException
              Severity: Minor
              Found in beem/price.py - About 6 hrs to fix
                Severity
                Category
                Status
                Source
                Language