holgern/beem

View on GitHub

Showing 683 of 2,332 total issues

Function _get_followers has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
Open

    def _get_followers(self, direction="follower", last_user="", what="blog", limit=100):
        """ Help function, used in get_followers and get_following
        """
        if not self.blockchain.is_connected():
            raise OfflineHasNoRPCException("No RPC available in offline mode!")
Severity: Minor
Found in beem/account.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 utils.py has 438 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
import re
import json
import time as timenow
import math
Severity: Minor
Found in beem/utils.py - About 6 hrs to fix

    Function stream has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
    Open

        def stream(self, opNames=[], raw_ops=False, *args, **kwargs):
            """ Yield specific operations (e.g. comments) only
    
                :param array opNames: List of operations to filter for
                :param bool raw_ops: When set to True, it returns the unmodified operations (default: False)
    Severity: Minor
    Found in beem/blockchain.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

    Function draw has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
    Open

    def draw(block, trx_id, draws, participants, hashtype, separator, account, reply, without_replacement, markdown):
        """ Generate pseudo-random numbers based on trx id, block id and previous block id.
    
        When using --reply, the result is directly broadcasted as comment
        """
    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

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

    def verify(blocknumber, trx, use_api):
        """Returns the public signing keys for a block"""
        stm = shared_blockchain_instance()
        if stm.rpc is not None:
            stm.rpc.rpcconnect()
    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

    Function createpost has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
    Open

    def createpost(markdown_file, account, title, tags, community, beneficiaries, percent_steem_dollars, percent_hbd, max_accepted_payout, no_parse_body):
        """Creates a new markdown file with YAML header"""
        stm = shared_blockchain_instance()
        if stm.rpc is not None:
            stm.rpc.rpcconnect()
    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 nodelist.py has 424 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    import re
    import time
    import math
    from timeit import default_timer as timer
    Severity: Minor
    Found in beem/nodelist.py - About 6 hrs to fix

      Function get_account_history has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_account_history(self, index, limit, order=-1, start=None, stop=None, use_block_num=True, only_ops=[], exclude_ops=[], raw_output=False):
              """ Returns a generator for individual account transactions. This call can be used in a
                  ``for`` loop.
      
                  :param int index: first number of transactions to return
      Severity: Minor
      Found in beem/account.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

      Function _parse_json_data has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
      Open

          def _parse_json_data(self, comment):
              parse_times = [
                  "active", "cashout_time", "created", "last_payout", "last_update", "updated",
                  "max_cashout_time"
              ]
      Severity: Minor
      Found in beem/comment.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

      Function orderbook has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
      Open

      def orderbook(chart, limit, show_date, width, height, ascii):
          """Obtain orderbook of the internal market"""
          stm = shared_blockchain_instance()
          if stm.rpc is not None:
              stm.rpc.rpcconnect()
      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 memo.py has 419 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      from beem.instance import shared_blockchain_instance
      import random
      import os
      import struct
      Severity: Minor
      Found in beem/memo.py - About 6 hrs to fix

        File vote.py has 418 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        import json
        import math
        import pytz
        import logging
        Severity: Minor
        Found in beem/vote.py - About 6 hrs to fix

          Function history has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
          Open

          def history(account, limit, sort, max_length, virtual_ops, only_ops, exclude_ops, json_file):
              """ Returns account history operations as table
          
              """
              stm = shared_blockchain_instance()
          Severity: Minor
          Found in beem/cli.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

          Function get_network has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
          Open

              def get_network(self, props=None):
                  """ Identify the connected network. This call returns a
                      dictionary with keys chain_id, core_symbol and prefix
                  """
                  if props is None:
          Severity: Minor
          Found in beemapi/graphenerpc.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 community.py has 409 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # -*- coding: utf-8 -*-
          import pytz
          import json
          from datetime import datetime, timedelta, date, time
          import math
          Severity: Minor
          Found in beem/community.py - About 5 hrs to fix

            Function _check_error_message has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
            Open

                def _check_error_message(self, e, cnt):
                    """Check error message and decide what to do"""
                    doRetry = False
                    msg = exceptions.decodeRPCErrorMsg(e).strip()
                    if re.search("missing required active authority", msg):
            Severity: Minor
            Found in beemapi/noderpc.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

            Consider simplifying this complex logical expression.
            Open

                    if (price is not None and isinstance(price, string_types) and not base and not quote):
                        import re
                        price, assets = price.split(" ")
                        base_symbol, quote_symbol = assets_from_string(assets)
                        base = Asset(base_symbol, blockchain_instance=self.blockchain)
            Severity: Critical
            Found in beem/price.py - About 5 hrs to fix

              File wallet.py has 400 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # -*- coding: utf-8 -*-
              import logging
              import os
              from beemgraphenebase.account import PrivateKey
              from beem.instance import shared_blockchain_instance
              Severity: Minor
              Found in beem/wallet.py - About 5 hrs to fix

                Function json has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
                Open

                    def json(self):
                        output = self.copy()
                        if "authorperm" in output:
                            output.pop("authorperm")
                        if 'json_metadata' in output:
                Severity: Minor
                Found in beem/comment.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

                Comment has 40 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class Comment(BlockchainObject):
                    """ Read data about a Comment/Post in the chain
                
                        :param str authorperm: identifier to post/comment in the form of
                            ``@author/permlink``
                Severity: Minor
                Found in beem/comment.py - About 5 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language