holgern/beem

View on GitHub
beem/blockchain.py

Summary

Maintainability
F
2 wks
Test Coverage
D
68%

Function blocks has a Cognitive Complexity of 171 (exceeds 5 allowed). Consider refactoring.
Open

    def blocks(self, start=None, stop=None, max_batch_size=None, threading=False, thread_num=8, only_ops=False, only_virtual_ops=False):
        """ Yields blocks starting from ``start``.

            :param int start: Starting block
            :param int stop: Stop at this block
Severity: Minor
Found in beem/blockchain.py - About 3 days 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 blockchain.py has 866 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
import sys
import time
import hashlib
import json
Severity: Major
Found in beem/blockchain.py - About 2 days to fix

    Cyclomatic complexity is too high in method blocks. (52)
    Open

        def blocks(self, start=None, stop=None, max_batch_size=None, threading=False, thread_num=8, only_ops=False, only_virtual_ops=False):
            """ Yields blocks starting from ``start``.
    
                :param int start: Starting block
                :param int stop: Stop at this block
    Severity: Minor
    Found in beem/blockchain.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    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

    Cyclomatic complexity is too high in method stream. (22)
    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 by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Function get_account_reputations has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_account_reputations(self, start='', stop='', steps=1e3, limit=-1, **kwargs):
            """ Yields account reputation between start and stop.
    
                :param str start: Start at this account name
                :param str stop: Stop at this account name
    Severity: Minor
    Found in beem/blockchain.py - About 3 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_all_accounts has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_all_accounts(self, start='', stop='', steps=1e3, limit=-1, **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 beem/blockchain.py - About 3 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

    Cyclomatic complexity is too high in method get_account_reputations. (15)
    Open

        def get_account_reputations(self, start='', stop='', steps=1e3, limit=-1, **kwargs):
            """ Yields account reputation between start and stop.
    
                :param str start: Start at this account name
                :param str stop: Stop at this account name
    Severity: Minor
    Found in beem/blockchain.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in method get_estimated_block_num. (15)
    Open

        def get_estimated_block_num(self, date, estimateForwards=False, accurate=True):
            """ This call estimates the block number based on a given date
    
                :param datetime date: block time for which a block number is estimated
    
    
    Severity: Minor
    Found in beem/blockchain.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in method get_all_accounts. (14)
    Open

        def get_all_accounts(self, start='', stop='', steps=1e3, limit=-1, **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 beem/blockchain.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in method wait_for_and_get_block. (14)
    Open

        def wait_for_and_get_block(self, block_number, blocks_waiting_for=None, only_ops=False, only_virtual_ops=False, block_number_check_cnt=-1, last_current_block_num=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.
    
                :param int block_number: desired block number
    Severity: Minor
    Found in beem/blockchain.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Function get_estimated_block_num has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_estimated_block_num(self, date, estimateForwards=False, accurate=True):
            """ This call estimates the block number based on a given date
    
                :param datetime date: block time for which a block number is estimated
    
    
    Severity: Minor
    Found in beem/blockchain.py - About 3 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

    Blockchain has 25 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Blockchain(object):
        """ This class allows to access the blockchain and read data
            from it
    
            :param Steem/Hive blockchain_instance: Steem or Hive instance
    Severity: Minor
    Found in beem/blockchain.py - About 2 hrs to fix

      Function wait_for_and_get_block has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          def wait_for_and_get_block(self, block_number, blocks_waiting_for=None, only_ops=False, only_virtual_ops=False, block_number_check_cnt=-1, last_current_block_num=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.
      
                  :param int block_number: desired block number
      Severity: Minor
      Found in beem/blockchain.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

      Cyclomatic complexity is too high in method ops_statistics. (10)
      Open

          def ops_statistics(self, start, stop=None, add_to_ops_stat=None, with_virtual_ops=True, verbose=False):
              """ Generates statistics for all operations (including virtual operations) starting from
                  ``start``.
      
                  :param int start: Starting block
      Severity: Minor
      Found in beem/blockchain.py by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Cyclomatic complexity is too high in method __init__. (8)
      Open

          def __init__(
              self,
              blockchain_instance=None,
              mode="irreversible",
              max_block_wait_repetition=None,
      Severity: Minor
      Found in beem/blockchain.py by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Cyclomatic complexity is too high in class Blockchain. (7)
      Open

      class Blockchain(object):
          """ This class allows to access the blockchain and read data
              from it
      
              :param Steem/Hive blockchain_instance: Steem or Hive instance
      Severity: Minor
      Found in beem/blockchain.py by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Function ops_statistics has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def ops_statistics(self, start, stop=None, add_to_ops_stat=None, with_virtual_ops=True, verbose=False):
              """ Generates statistics for all operations (including virtual operations) starting from
                  ``start``.
      
                  :param int start: Starting block
      Severity: Minor
      Found in beem/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

      Cyclomatic complexity is too high in method hash_op. (6)
      Open

          @staticmethod
          def hash_op(event):
              """ This method generates a hash of blockchain operation. """
              if isinstance(event, dict) and "type" in event and "value" in event:
                  op_type = event["type"]
      Severity: Minor
      Found in beem/blockchain.py by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

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

          def __init__(
              self,
              blockchain_instance=None,
              mode="irreversible",
              max_block_wait_repetition=None,
      Severity: Minor
      Found in beem/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 blocks has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def blocks(self, start=None, stop=None, max_batch_size=None, threading=False, thread_num=8, only_ops=False, only_virtual_ops=False):
      Severity: Major
      Found in beem/blockchain.py - About 50 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if only_virtual_ops:
                                    if self.blockchain.rpc.get_use_appbase():
                                        block_batch = self.blockchain.rpc.get_ops_in_block({"block_num": blocknum, 'only_virtual': only_virtual_ops}, api="account_history", add_to_queue=add_to_queue)
                                    else:
                                        block_batch = self.blockchain.rpc.get_ops_in_block(blocknum, only_virtual_ops, add_to_queue=add_to_queue)
        Severity: Major
        Found in beem/blockchain.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if b.block_num is not None and int(b.block_num) not in result_block_nums:
                                      b["id"] = b.block_num
                                      b.identifier = b.block_num
                                      checked_results.append(b)
                                      result_block_nums.append(int(b.block_num))
          Severity: Major
          Found in beem/blockchain.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if not bool(block):
                                        continue
                                    if self.blockchain.rpc.get_use_appbase():
            Severity: Major
            Found in beem/blockchain.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if blocknum == blocknumblock + batches - 1:
                                          add_to_queue = False  # execute the call with the last request
                                      else:
                                          add_to_queue = True  # append request to the queue w/o executing
                                      if only_virtual_ops:
              Severity: Major
              Found in beem/blockchain.py - About 45 mins to fix

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

                    def wait_for_and_get_block(self, block_number, blocks_waiting_for=None, only_ops=False, only_virtual_ops=False, block_number_check_cnt=-1, last_current_block_num=None):
                Severity: Minor
                Found in beem/blockchain.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if FUTURES_MODULE is not None:
                                              futures.append(pool.submit(Block, blocknum + i, only_ops=only_ops, only_virtual_ops=only_virtual_ops, blockchain_instance=blockchain_instance[i]))
                                          else:
                                              pool.enqueue(Block, blocknum + i, only_ops=only_ops, only_virtual_ops=only_virtual_ops, blockchain_instance=blockchain_instance[i])
                                          i += 1
                  Severity: Major
                  Found in beem/blockchain.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            for result in pool.results():
                                                results.append(result)
                                            pool.abort()
                    Severity: Major
                    Found in beem/blockchain.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              for blocknum in missing_block_num:
                                                  try:
                                                      block = Block(blocknum, only_ops=only_ops, only_virtual_ops=only_virtual_ops, blockchain_instance=self.blockchain)
                                                      checked_results.append(block)
                                                      result_block_nums.append(int(block.block_num))
                      Severity: Major
                      Found in beem/blockchain.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if latest_block < int(b.block_num):
                                                    latest_block = int(b.block_num)
                                                yield b
                        Severity: Major
                        Found in beem/blockchain.py - About 45 mins to fix

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

                              def __init__(self, name, queue, results, abort, idle, exception_handler):
                          Severity: Minor
                          Found in beem/blockchain.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
                            
                                        :param dict transaction: transaction to wait for
                            Severity: Minor
                            Found in beem/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

                            Avoid deeply nested control flow statements.
                            Open

                                                    if blocknum not in result_block_nums:
                                                        block = Block(blocknum, only_ops=only_ops, only_virtual_ops=only_virtual_ops, blockchain_instance=self.blockchain)
                                                        result_block_nums.append(blocknum)
                                                        yield block
                                        elif max_batch_size is not None and (head_block - start) >= max_batch_size and not head_block_reached:
                            Severity: Major
                            Found in beem/blockchain.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                      if len(op_type) > 10 and op_type[len(op_type) - 10:] == "_operation":
                                                          op_type = op_type[:-10]
                                                      op = event["value"]
                              Severity: Major
                              Found in beem/blockchain.py - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                        if len(op_type) > 10 and op_type[len(op_type) - 10:] == "_operation":
                                                            op_type = op_type[:-10]
                                                        op = event["op"]["value"]
                                Severity: Major
                                Found in beem/blockchain.py - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                          if self.blockchain.rpc.get_use_appbase():
                                                              if only_virtual_ops:
                                                                  block = {'block': block['ops'][0]["block"],
                                                                           'timestamp': block['ops'][0]["timestamp"],
                                                                           'id': block['ops'][0]['block'],
                                  Severity: Major
                                  Found in beem/blockchain.py - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                            if raw_ops:
                                                                yield {"block_num": block_num,
                                                                       "trx_num": trx_nr,
                                                                       "op": [op_type, op],
                                                                       "timestamp": timestamp}
                                    Severity: Major
                                    Found in beem/blockchain.py - About 45 mins to fix

                                      Consider simplifying this complex logical expression.
                                      Open

                                                          if isinstance(event, list):
                                                              op_type, op = event
                                                              trx_id = block["transaction_ids"][trx_nr]
                                                              block_num = block.get("id")
                                                              _id = self.hash_op(event)
                                      Severity: Major
                                      Found in beem/blockchain.py - About 40 mins to fix

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

                                            def get_all_accounts(self, start='', stop='', steps=1e3, limit=-1, **kwargs):
                                        Severity: Minor
                                        Found in beem/blockchain.py - About 35 mins to fix

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

                                              def get_account_reputations(self, start='', stop='', steps=1e3, limit=-1, **kwargs):
                                          Severity: Minor
                                          Found in beem/blockchain.py - About 35 mins to fix

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

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

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

                                                  def ops_statistics(self, start, stop=None, add_to_ops_stat=None, with_virtual_ops=True, verbose=False):
                                              Severity: Minor
                                              Found in beem/blockchain.py - About 35 mins to fix

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

                                                    def find_rc_accounts(self, name):
                                                        """ Returns the RC parameters of one or more accounts.
                                                
                                                        :param str name: account name to search rc params for (can also be a list of accounts)
                                                        :returns: RC params
                                                Severity: Minor
                                                Found in beem/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 run has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                Open

                                                    def run(self):
                                                        """Thread work loop calling the function with the params"""
                                                        # keep running until told to abort
                                                        while not self.abort.is_set():
                                                            try:
                                                Severity: Minor
                                                Found in beem/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

                                                Refactor this function to reduce its Cognitive Complexity from 28 to the 15 allowed.
                                                Open

                                                    def get_account_reputations(self, start='', stop='', steps=1e3, limit=-1, **kwargs):
                                                Severity: Critical
                                                Found in beem/blockchain.py by sonar-python

                                                Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

                                                See

                                                Refactor this function to reduce its Cognitive Complexity from 27 to the 15 allowed.
                                                Open

                                                    def get_all_accounts(self, start='', stop='', steps=1e3, limit=-1, **kwargs):
                                                Severity: Critical
                                                Found in beem/blockchain.py by sonar-python

                                                Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

                                                See

                                                Method "blocks" has 8 parameters, which is greater than the 7 authorized.
                                                Open

                                                    def blocks(self, start=None, stop=None, max_batch_size=None, threading=False, thread_num=8, only_ops=False, only_virtual_ops=False):
                                                Severity: Major
                                                Found in beem/blockchain.py by sonar-python

                                                A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.

                                                Noncompliant Code Example

                                                With a maximum number of 4 parameters:

                                                def do_something(param1, param2, param3, param4, param5):
                                                    ...
                                                

                                                Compliant Solution

                                                def do_something(param1, param2, param3, param4):
                                                    ...
                                                

                                                Refactor this function to reduce its Cognitive Complexity from 20 to the 15 allowed.
                                                Open

                                                    def wait_for_and_get_block(self, block_number, blocks_waiting_for=None, only_ops=False, only_virtual_ops=False, block_number_check_cnt=-1, last_current_block_num=None):
                                                Severity: Critical
                                                Found in beem/blockchain.py by sonar-python

                                                Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

                                                See

                                                Rename field "blockchain"
                                                Open

                                                        self.blockchain = blockchain_instance or shared_blockchain_instance()
                                                Severity: Major
                                                Found in beem/blockchain.py by sonar-python

                                                It's confusing to have a class member with the same name (case differences aside) as its enclosing class. This is particularly so when you consider the common practice of naming a class instance for the class itself.

                                                Best practice dictates that any field or member with the same name as the enclosing class be renamed to be more descriptive of the particular aspect of the class it represents or holds.

                                                Noncompliant Code Example

                                                class Foo:
                                                  foo = ''
                                                
                                                  def getFoo(self):
                                                    ...
                                                
                                                foo = Foo()
                                                foo.getFoo() # what does this return?
                                                

                                                Compliant Solution

                                                class Foo:
                                                  name = ''
                                                
                                                  def getName(self):
                                                    ...
                                                
                                                foo = Foo()
                                                foo.getName()
                                                

                                                Refactor this function to reduce its Cognitive Complexity from 175 to the 15 allowed.
                                                Open

                                                    def blocks(self, start=None, stop=None, max_batch_size=None, threading=False, thread_num=8, only_ops=False, only_virtual_ops=False):
                                                Severity: Critical
                                                Found in beem/blockchain.py by sonar-python

                                                Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

                                                See

                                                Refactor this function to reduce its Cognitive Complexity from 25 to the 15 allowed.
                                                Open

                                                    def get_estimated_block_num(self, date, estimateForwards=False, accurate=True):
                                                Severity: Critical
                                                Found in beem/blockchain.py by sonar-python

                                                Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

                                                See

                                                Refactor this function to reduce its Cognitive Complexity from 45 to the 15 allowed.
                                                Open

                                                    def stream(self, opNames=[], raw_ops=False, *args, **kwargs):
                                                Severity: Critical
                                                Found in beem/blockchain.py by sonar-python

                                                Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

                                                See

                                                Remove this commented out code.
                                                Open

                                                                    # self.blockchain.rpc.nodes.freeze_current_node = freeze
                                                Severity: Major
                                                Found in beem/blockchain.py by sonar-python

                                                Programmers should not comment out code as it bloats programs and reduces readability.

                                                Unused code should be deleted and can be retrieved from source control history if required.

                                                See

                                                • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
                                                • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
                                                • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
                                                • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

                                                Remove this commented out code.
                                                Open

                                                                    # self.blockchain.rpc.nodes.freeze_current_node = True
                                                Severity: Major
                                                Found in beem/blockchain.py by sonar-python

                                                Programmers should not comment out code as it bloats programs and reduces readability.

                                                Unused code should be deleted and can be retrieved from source control history if required.

                                                See

                                                • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
                                                • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
                                                • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
                                                • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

                                                Remove this commented out code.
                                                Open

                                                        # FUTURES_MODULE = None
                                                Severity: Major
                                                Found in beem/blockchain.py by sonar-python

                                                Programmers should not comment out code as it bloats programs and reduces readability.

                                                Unused code should be deleted and can be retrieved from source control history if required.

                                                See

                                                • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
                                                • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
                                                • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
                                                • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

                                                Remove this commented out code.
                                                Open

                                                                    # futures = []
                                                Severity: Major
                                                Found in beem/blockchain.py by sonar-python

                                                Programmers should not comment out code as it bloats programs and reduces readability.

                                                Unused code should be deleted and can be retrieved from source control history if required.

                                                See

                                                • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
                                                • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
                                                • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
                                                • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

                                                Remove this commented out code.
                                                Open

                                                                    # freeze = self.blockchain.rpc.nodes.freeze_current_node
                                                Severity: Major
                                                Found in beem/blockchain.py by sonar-python

                                                Programmers should not comment out code as it bloats programs and reduces readability.

                                                Unused code should be deleted and can be retrieved from source control history if required.

                                                See

                                                • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
                                                • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
                                                • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
                                                • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

                                                Either merge this branch with the identical one on line "588" or change one of the implementations.
                                                Open

                                                            last_current_block_num = self.get_current_block_num()
                                                Severity: Major
                                                Found in beem/blockchain.py by sonar-python

                                                Having two branches in the same if structure with the same implementation is at best duplicate code, and at worst a coding error. If the same logic is truly needed for both instances, then they should be combined.

                                                Noncompliant Code Example

                                                if 0 <= a < 10:
                                                    do_the_thing()
                                                elif 10 <= a < 20:
                                                    do_the_other_thing()
                                                elif 20 <= a < 50:
                                                    do_the_thing()  # Noncompliant; duplicates first condition
                                                else:
                                                    do_the_rest()
                                                
                                                b = 4 if a > 12 else 4
                                                

                                                Compliant Solution

                                                if (0 <= a < 10) or (20 <= a < 50):
                                                    do_the_thing()
                                                elif 10 <= a < 20:
                                                    do_the_other_thing()
                                                else:
                                                    do_the_rest()
                                                
                                                b = 4
                                                

                                                or

                                                if 0 <= a < 10:
                                                    do_the_thing()
                                                elif 10 <= a < 20:
                                                    do_the_other_thing()
                                                elif 20 <= a < 50:
                                                    do_the_third_thing()
                                                else:
                                                    do_the_rest()
                                                
                                                b = 8 if a > 12 else 4
                                                

                                                Similar blocks of code found in 2 locations. Consider refactoring.
                                                Open

                                                        for block in self.blocks(start=start, stop=stop, only_ops=False, only_virtual_ops=False):
                                                            if verbose:
                                                                print(block["identifier"] + " " + block["timestamp"])
                                                            ops_stat = block.ops_statistics(add_to_ops_stat=ops_stat)
                                                Severity: Major
                                                Found in beem/blockchain.py and 1 other location - About 3 hrs to fix
                                                beem/blockchain.py on lines 655..659

                                                Duplicated Code

                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                Tuning

                                                This issue has a mass of 67.

                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                Refactorings

                                                Further Reading

                                                Similar blocks of code found in 2 locations. Consider refactoring.
                                                Open

                                                        if with_virtual_ops:
                                                            for block in self.blocks(start=start, stop=stop, only_ops=True, only_virtual_ops=True):
                                                                if verbose:
                                                                    print(block["identifier"] + " " + block["timestamp"])
                                                                ops_stat = block.ops_statistics(add_to_ops_stat=ops_stat)
                                                Severity: Major
                                                Found in beem/blockchain.py and 1 other location - About 3 hrs to fix
                                                beem/blockchain.py on lines 651..654

                                                Duplicated Code

                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                Tuning

                                                This issue has a mass of 67.

                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                Refactorings

                                                Further Reading

                                                Similar blocks of code found in 2 locations. Consider refactoring.
                                                Open

                                                            if self.blockchain.rpc.get_use_appbase():
                                                                ret = self.blockchain.rpc.list_accounts({'start': lastname, 'limit': steps, 'order': 'by_name'}, api="database")["accounts"]
                                                            else:
                                                                ret = self.blockchain.rpc.lookup_accounts(lastname, steps)
                                                Severity: Major
                                                Found in beem/blockchain.py and 1 other location - About 3 hrs to fix
                                                beem/witness.py on lines 513..516

                                                Duplicated Code

                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                Tuning

                                                This issue has a mass of 62.

                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                Refactorings

                                                Further Reading

                                                Similar blocks of code found in 2 locations. Consider refactoring.
                                                Open

                                                        if self.blockchain.rpc.get_use_appbase():
                                                            ret = self.blockchain.rpc.get_transaction_hex({'trx': transaction}, api="database")["hex"]
                                                        else:
                                                            ret = self.blockchain.rpc.get_transaction_hex(transaction, api="database")
                                                Severity: Major
                                                Found in beem/blockchain.py and 1 other location - About 2 hrs to fix
                                                beem/market.py on lines 335..338

                                                Duplicated Code

                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                Tuning

                                                This issue has a mass of 61.

                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                Refactorings

                                                Further Reading

                                                Similar blocks of code found in 2 locations. Consider refactoring.
                                                Open

                                                        if self.blockchain.rpc.get_use_appbase():
                                                            ret = self.blockchain.rpc.get_transaction({'id': transaction_id}, api="account_history")
                                                        else:
                                                            ret = self.blockchain.rpc.get_transaction(transaction_id, api="database")
                                                Severity: Major
                                                Found in beem/blockchain.py and 1 other location - About 2 hrs to fix
                                                beem/market.py on lines 277..280

                                                Duplicated Code

                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                Tuning

                                                This issue has a mass of 55.

                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                Refactorings

                                                Further Reading

                                                Identical blocks of code found in 2 locations. Consider refactoring.
                                                Open

                                                        if add_to_ops_stat is None:
                                                            import beembase.operationids
                                                            ops_stat = beembase.operationids.operations.copy()
                                                            for key in ops_stat:
                                                                ops_stat[key] = 0
                                                Severity: Major
                                                Found in beem/blockchain.py and 1 other location - About 2 hrs to fix
                                                beem/block.py on lines 268..274

                                                Duplicated Code

                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                Tuning

                                                This issue has a mass of 53.

                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                Refactorings

                                                Further Reading

                                                Identical blocks of code found in 5 locations. Consider refactoring.
                                                Open

                                                                        if len(op_type) > 10 and op_type[len(op_type) - 10:] == "_operation":
                                                                            op_type = op_type[:-10]
                                                Severity: Major
                                                Found in beem/blockchain.py and 4 other locations - About 2 hrs to fix
                                                beem/account.py on lines 2166..2167
                                                beem/block.py on lines 280..281
                                                beem/blockchain.py on lines 742..743
                                                beem/blockchain.py on lines 816..817

                                                Duplicated Code

                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                Tuning

                                                This issue has a mass of 52.

                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                Refactorings

                                                Further Reading

                                                Identical blocks of code found in 5 locations. Consider refactoring.
                                                Open

                                                            if len(op_type) > 10 and op_type[len(op_type) - 10:] == "_operation":
                                                                op_type = op_type[:-10]
                                                Severity: Major
                                                Found in beem/blockchain.py and 4 other locations - About 2 hrs to fix
                                                beem/account.py on lines 2166..2167
                                                beem/block.py on lines 280..281
                                                beem/blockchain.py on lines 742..743
                                                beem/blockchain.py on lines 751..752

                                                Duplicated Code

                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                Tuning

                                                This issue has a mass of 52.

                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                Refactorings

                                                Further Reading

                                                Identical blocks of code found in 5 locations. Consider refactoring.
                                                Open

                                                                        if len(op_type) > 10 and op_type[len(op_type) - 10:] == "_operation":
                                                                            op_type = op_type[:-10]
                                                Severity: Major
                                                Found in beem/blockchain.py and 4 other locations - About 2 hrs to fix
                                                beem/account.py on lines 2166..2167
                                                beem/block.py on lines 280..281
                                                beem/blockchain.py on lines 751..752
                                                beem/blockchain.py on lines 816..817

                                                Duplicated Code

                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                Tuning

                                                This issue has a mass of 52.

                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                Refactorings

                                                Further Reading

                                                Identical blocks of code found in 2 locations. Consider refactoring.
                                                Open

                                                                if repetition > blocks_waiting_for * self.max_block_wait_repetition:
                                                                    raise BlockWaitTimeExceeded("Already waited %d s" % (blocks_waiting_for * self.max_block_wait_repetition * self.block_interval))
                                                Severity: Major
                                                Found in beem/blockchain.py and 1 other location - About 1 hr to fix
                                                beem/blockchain.py on lines 615..616

                                                Duplicated Code

                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                Tuning

                                                This issue has a mass of 47.

                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                Refactorings

                                                Further Reading

                                                Identical blocks of code found in 2 locations. Consider refactoring.
                                                Open

                                                                if repetition > blocks_waiting_for * self.max_block_wait_repetition:
                                                                    raise BlockWaitTimeExceeded("Already waited %d s" % (blocks_waiting_for * self.max_block_wait_repetition * self.block_interval))
                                                Severity: Major
                                                Found in beem/blockchain.py and 1 other location - About 1 hr to fix
                                                beem/blockchain.py on lines 603..604

                                                Duplicated Code

                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                Tuning

                                                This issue has a mass of 47.

                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                Refactorings

                                                Further Reading

                                                Similar blocks of code found in 2 locations. Consider refactoring.
                                                Open

                                                                if account_name != lastname or skip_first is False:
                                                                    yield account
                                                                    cnt += 1
                                                                    if account_name == stop or (limit > 0 and cnt > limit):
                                                Severity: Major
                                                Found in beem/blockchain.py and 1 other location - About 1 hr to fix
                                                beem/blockchain.py on lines 848..851

                                                Duplicated Code

                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                Tuning

                                                This issue has a mass of 46.

                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                Refactorings

                                                Further Reading

                                                Similar blocks of code found in 2 locations. Consider refactoring.
                                                Open

                                                                if account_name != lastname:
                                                                    yield account_name
                                                                    cnt += 1
                                                                    if account_name == stop or (limit > 0 and cnt > limit):
                                                Severity: Major
                                                Found in beem/blockchain.py and 1 other location - About 1 hr to fix
                                                beem/blockchain.py on lines 895..898

                                                Duplicated Code

                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                Tuning

                                                This issue has a mass of 46.

                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                Refactorings

                                                Further Reading

                                                Identical blocks of code found in 2 locations. Consider refactoring.
                                                Open

                                                        if self.blockchain.rpc.get_use_appbase() and start == "":
                                                            lastname = None
                                                        else:
                                                            lastname = start
                                                Severity: Minor
                                                Found in beem/blockchain.py and 1 other location - About 40 mins to fix
                                                beem/blockchain.py on lines 833..836

                                                Duplicated Code

                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                Tuning

                                                This issue has a mass of 34.

                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                Refactorings

                                                Further Reading

                                                Identical blocks of code found in 2 locations. Consider refactoring.
                                                Open

                                                        if self.blockchain.rpc.get_use_appbase() and start == "":
                                                            lastname = None
                                                        else:
                                                            lastname = start
                                                Severity: Minor
                                                Found in beem/blockchain.py and 1 other location - About 40 mins to fix
                                                beem/blockchain.py on lines 878..881

                                                Duplicated Code

                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                Tuning

                                                This issue has a mass of 34.

                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                Refactorings

                                                Further Reading

                                                There are no issues that match your filters.

                                                Category
                                                Status