holgern/beem

View on GitHub
beem/snapshot.py

Summary

Maintainability
F
2 wks
Test Coverage
F
7%

Function parse_op has a Cognitive Complexity of 101 (exceeds 5 allowed). Consider refactoring.
Open

    def parse_op(self, op, only_ops=[], enable_rewards=False, enable_out_votes=False, enable_in_votes=False):
        """ Parse account history operation"""
        ts = parse_time(op['timestamp'])

        if op['type'] == "account_create":
Severity: Minor
Found in beem/snapshot.py - About 2 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

Cyclomatic complexity is too high in method parse_op. (61)
Open

    def parse_op(self, op, only_ops=[], enable_rewards=False, enable_out_votes=False, enable_in_votes=False):
        """ Parse account history operation"""
        ts = parse_time(op['timestamp'])

        if op['type'] == "account_create":
Severity: Minor
Found in beem/snapshot.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

File snapshot.py has 555 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

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

        def build_vp_arrays(self):
            """ Build vote power arrays"""
            self.vp_timestamp = [self.timestamps[1]]
            self.vp = [STEEM_100_PERCENT]
            HF_21 = datetime(2019, 8, 27, 15, tzinfo=pytz.utc)
    Severity: Minor
    Found in beem/snapshot.py - About 7 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Cyclomatic complexity is too high in method get_ops. (30)
    Open

        def get_ops(self, start=None, stop=None, use_block_num=True, only_ops=[], exclude_ops=[]):
            """ Returns ops in the given range"""
            if start is not None:
                start = addTzInfo(start)
            if stop is not None:
    Severity: Minor
    Found in beem/snapshot.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 search. (27)
    Open

        def search(self, search_str, start=None, stop=None, use_block_num=True):
            """ Returns ops in the given range"""
            ops = []
            if start is not None:
                start = addTzInfo(start)
    Severity: Minor
    Found in beem/snapshot.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_ops has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_ops(self, start=None, stop=None, use_block_num=True, only_ops=[], exclude_ops=[]):
            """ Returns ops in the given range"""
            if start is not None:
                start = addTzInfo(start)
            if stop is not None:
    Severity: Minor
    Found in beem/snapshot.py - About 5 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function search has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

        def search(self, search_str, start=None, stop=None, use_block_num=True):
            """ Returns ops in the given range"""
            ops = []
            if start is not None:
                start = addTzInfo(start)
    Severity: Minor
    Found in beem/snapshot.py - About 4 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 build_vp_arrays. (20)
    Open

        def build_vp_arrays(self):
            """ Build vote power arrays"""
            self.vp_timestamp = [self.timestamps[1]]
            self.vp = [STEEM_100_PERCENT]
            HF_21 = datetime(2019, 8, 27, 15, tzinfo=pytz.utc)
    Severity: Minor
    Found in beem/snapshot.py 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 AccountSnapshot. (11)
    Open

    class AccountSnapshot(list):
        """ This class allows to easily access Account history
    
            :param str account_name: Name of the account
            :param Steem blockchain_instance: Steem
    Severity: Minor
    Found in beem/snapshot.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 update. (10)
    Open

        def update(self, timestamp, own, delegated_in=None, delegated_out=None, steem=0, sbd=0):
            """ Updates the internal state arrays
    
                :param datetime timestamp: datetime of the update
                :param own: vests
    Severity: Minor
    Found in beem/snapshot.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 build_curation_arrays. (9)
    Open

        def build_curation_arrays(self, end_date=None, sum_days=7):
            """ Build curation arrays"""
            self.curation_per_1000_SP_timestamp = []
            self.curation_per_1000_SP = []
            if sum_days <= 0:
    Severity: Minor
    Found in beem/snapshot.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 build. (8)
    Open

        def build(self, only_ops=[], exclude_ops=[], enable_rewards=False, enable_out_votes=False, enable_in_votes=False):
            """ Builds the account history based on all account operations
    
                :param array only_ops: Limit generator by these
                    operations (*optional*)
    Severity: Minor
    Found in beem/snapshot.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 update has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def update(self, timestamp, own, delegated_in=None, delegated_out=None, steem=0, sbd=0):
            """ Updates the internal state arrays
    
                :param datetime timestamp: datetime of the update
                :param own: vests
    Severity: Minor
    Found in beem/snapshot.py - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

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

        def build_curation_arrays(self, end_date=None, sum_days=7):
            """ Build curation arrays"""
            self.curation_per_1000_SP_timestamp = []
            self.curation_per_1000_SP = []
            if sum_days <= 0:
    Severity: Minor
    Found in beem/snapshot.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 get_data. (6)
    Open

        def get_data(self, timestamp=None, index=0):
            """ Returns snapshot for given timestamp"""
            if timestamp is None:
                timestamp = datetime.utcnow()
            timestamp = addTzInfo(timestamp)
    Severity: Minor
    Found in beem/snapshot.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 build_rep_arrays. (6)
    Open

        def build_rep_arrays(self):
            """ Build reputation arrays """
            self.rep_timestamp = [self.timestamps[1]]
            self.rep = [reputation_to_score(0)]
            current_reputation = 0
    Severity: Minor
    Found in beem/snapshot.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 reset has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def reset(self):
            """ Resets the arrays not the stored account history
            """
            self.own_vests = [Amount(0, self.blockchain.vest_token_symbol, blockchain_instance=self.blockchain)]
            self.own_steem = [Amount(0, self.blockchain.token_symbol, blockchain_instance=self.blockchain)]
    Severity: Minor
    Found in beem/snapshot.py - About 1 hr to fix

      Function build has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def build(self, only_ops=[], exclude_ops=[], enable_rewards=False, enable_out_votes=False, enable_in_votes=False):
              """ Builds the account history based on all account operations
      
                  :param array only_ops: Limit generator by these
                      operations (*optional*)
      Severity: Minor
      Found in beem/snapshot.py - About 55 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 update has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def update(self, timestamp, own, delegated_in=None, delegated_out=None, steem=0, sbd=0):
      Severity: Minor
      Found in beem/snapshot.py - About 45 mins to fix

        Function build_rep_arrays has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def build_rep_arrays(self):
                """ Build reputation arrays """
                self.rep_timestamp = [self.timestamps[1]]
                self.rep = [reputation_to_score(0)]
                current_reputation = 0
        Severity: Minor
        Found in beem/snapshot.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

        Consider simplifying this complex logical expression.
        Open

                    if use_block_num and stop is not None and isinstance(stop, int):
                        if op["block"] > stop:
                            continue
                    elif not use_block_num and stop is not None and isinstance(stop, int):
                        if op["index"] > stop:
        Severity: Major
        Found in beem/snapshot.py - About 40 mins to fix

          Consider simplifying this complex logical expression.
          Open

                      if use_block_num and stop is not None and isinstance(stop, int):
                          if op["block"] > stop:
                              continue
                      elif not use_block_num and stop is not None and isinstance(stop, int):
                          if op["index"] > stop:
          Severity: Major
          Found in beem/snapshot.py - About 40 mins to fix

            Consider simplifying this complex logical expression.
            Open

                        if use_block_num and start is not None and isinstance(start, int):
                            if op["block"] < start:
                                continue
                        elif not use_block_num and start is not None and isinstance(start, int):
                            if op["index"] < start:
            Severity: Major
            Found in beem/snapshot.py - About 40 mins to fix

              Consider simplifying this complex logical expression.
              Open

                          if use_block_num and start is not None and isinstance(start, int):
                              if op["block"] < start:
                                  continue
                          elif not use_block_num and start is not None and isinstance(start, int):
                              if op["index"] < start:
              Severity: Major
              Found in beem/snapshot.py - About 40 mins to fix

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

                    def update_rewards(self, timestamp, curation_reward, author_vests, author_steem, author_sbd):
                Severity: Minor
                Found in beem/snapshot.py - About 35 mins to fix

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

                      def build(self, only_ops=[], exclude_ops=[], enable_rewards=False, enable_out_votes=False, enable_in_votes=False):
                  Severity: Minor
                  Found in beem/snapshot.py - About 35 mins to fix

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

                        def parse_op(self, op, only_ops=[], enable_rewards=False, enable_out_votes=False, enable_in_votes=False):
                    Severity: Minor
                    Found in beem/snapshot.py - About 35 mins to fix

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

                          def get_ops(self, start=None, stop=None, use_block_num=True, only_ops=[], exclude_ops=[]):
                      Severity: Minor
                      Found in beem/snapshot.py - About 35 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                    return
                        Severity: Major
                        Found in beem/snapshot.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                      return
                          Severity: Major
                          Found in beem/snapshot.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                            return
                            Severity: Major
                            Found in beem/snapshot.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                          return
                              Severity: Major
                              Found in beem/snapshot.py - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                            return
                                Severity: Major
                                Found in beem/snapshot.py - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                              return
                                  Severity: Major
                                  Found in beem/snapshot.py - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                                return
                                    Severity: Major
                                    Found in beem/snapshot.py - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                                  return
                                      Severity: Major
                                      Found in beem/snapshot.py - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                                    return
                                        Severity: Major
                                        Found in beem/snapshot.py - About 30 mins to fix

                                          Avoid too many return statements within this function.
                                          Open

                                                          return
                                          Severity: Major
                                          Found in beem/snapshot.py - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

                                                        return
                                            Severity: Major
                                            Found in beem/snapshot.py - About 30 mins to fix

                                              Avoid too many return statements within this function.
                                              Open

                                                          return
                                              Severity: Major
                                              Found in beem/snapshot.py - About 30 mins to fix

                                                Avoid too many return statements within this function.
                                                Open

                                                                return
                                                Severity: Major
                                                Found in beem/snapshot.py - About 30 mins to fix

                                                  Avoid too many return statements within this function.
                                                  Open

                                                              return
                                                  Severity: Major
                                                  Found in beem/snapshot.py - About 30 mins to fix

                                                    Avoid too many return statements within this function.
                                                    Open

                                                                return
                                                    Severity: Major
                                                    Found in beem/snapshot.py - About 30 mins to fix

                                                      Avoid too many return statements within this function.
                                                      Open

                                                                      return
                                                      Severity: Major
                                                      Found in beem/snapshot.py - About 30 mins to fix

                                                        Avoid too many return statements within this function.
                                                        Open

                                                                    return
                                                        Severity: Major
                                                        Found in beem/snapshot.py - About 30 mins to fix

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

                                                              def search(self, search_str, start=None, stop=None, use_block_num=True):
                                                          Severity: Critical
                                                          Found in beem/snapshot.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 41 to the 15 allowed.
                                                          Open

                                                              def get_ops(self, start=None, stop=None, use_block_num=True, only_ops=[], exclude_ops=[]):
                                                          Severity: Critical
                                                          Found in beem/snapshot.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 48 to the 15 allowed.
                                                          Open

                                                              def build_vp_arrays(self):
                                                          Severity: Critical
                                                          Found in beem/snapshot.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 103 to the 15 allowed.
                                                          Open

                                                              def parse_op(self, op, only_ops=[], enable_rewards=False, enable_out_votes=False, enable_in_votes=False):
                                                          Severity: Critical
                                                          Found in beem/snapshot.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 17 to the 15 allowed.
                                                          Open

                                                              def update(self, timestamp, own, delegated_in=None, delegated_out=None, steem=0, sbd=0):
                                                          Severity: Critical
                                                          Found in beem/snapshot.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

                                                          Merge this if statement with the enclosing one.
                                                          Open

                                                                          if start > formatTimeString(op["timestamp"]):
                                                          Severity: Major
                                                          Found in beem/snapshot.py by sonar-python

                                                          Merging collapsible if statements increases the code's readability.

                                                          Noncompliant Code Example

                                                          if condition1:
                                                              if condition2:
                                                                  # ...
                                                          

                                                          Compliant Solution

                                                          if condition1 and condition2:
                                                              # ...
                                                          

                                                          Merge this if statement with the enclosing one.
                                                          Open

                                                                          if rshares > 0 or (rshares < 0 and rep > current_reputation):
                                                          Severity: Major
                                                          Found in beem/snapshot.py by sonar-python

                                                          Merging collapsible if statements increases the code's readability.

                                                          Noncompliant Code Example

                                                          if condition1:
                                                              if condition2:
                                                                  # ...
                                                          

                                                          Compliant Solution

                                                          if condition1 and condition2:
                                                              # ...
                                                          

                                                          Merge this if statement with the enclosing one.
                                                          Open

                                                                          if stop < formatTimeString(op["timestamp"]):
                                                          Severity: Major
                                                          Found in beem/snapshot.py by sonar-python

                                                          Merging collapsible if statements increases the code's readability.

                                                          Noncompliant Code Example

                                                          if condition1:
                                                              if condition2:
                                                                  # ...
                                                          

                                                          Compliant Solution

                                                          if condition1 and condition2:
                                                              # ...
                                                          

                                                          Merge this if statement with the enclosing one.
                                                          Open

                                                                          if start > formatTimeString(op["timestamp"]):
                                                          Severity: Major
                                                          Found in beem/snapshot.py by sonar-python

                                                          Merging collapsible if statements increases the code's readability.

                                                          Noncompliant Code Example

                                                          if condition1:
                                                              if condition2:
                                                                  # ...
                                                          

                                                          Compliant Solution

                                                          if condition1 and condition2:
                                                              # ...
                                                          

                                                          Merge this if statement with the enclosing one.
                                                          Open

                                                                          if stop < formatTimeString(op["timestamp"]):
                                                          Severity: Major
                                                          Found in beem/snapshot.py by sonar-python

                                                          Merging collapsible if statements increases the code's readability.

                                                          Noncompliant Code Example

                                                          if condition1:
                                                              if condition2:
                                                                  # ...
                                                          

                                                          Compliant Solution

                                                          if condition1 and condition2:
                                                              # ...
                                                          

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

                                                                      if use_block_num and start is not None and isinstance(start, int):
                                                                          if op["block"] < start:
                                                                              continue
                                                                      elif not use_block_num and start is not None and isinstance(start, int):
                                                                          if op["index"] < start:
                                                          Severity: Major
                                                          Found in beem/snapshot.py and 1 other location - About 1 day to fix
                                                          beem/snapshot.py on lines 107..114

                                                          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 127.

                                                          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 use_block_num and start is not None and isinstance(start, int):
                                                                          if op["block"] < start:
                                                                              continue
                                                                      elif not use_block_num and start is not None and isinstance(start, int):
                                                                          if op["index"] < start:
                                                          Severity: Major
                                                          Found in beem/snapshot.py and 1 other location - About 1 day to fix
                                                          beem/snapshot.py on lines 77..84

                                                          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 127.

                                                          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 use_block_num and stop is not None and isinstance(stop, int):
                                                                          if op["block"] > stop:
                                                                              continue
                                                                      elif not use_block_num and stop is not None and isinstance(stop, int):
                                                                          if op["index"] > stop:
                                                          Severity: Major
                                                          Found in beem/snapshot.py and 1 other location - About 1 day to fix
                                                          beem/snapshot.py on lines 116..123

                                                          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 127.

                                                          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 use_block_num and stop is not None and isinstance(stop, int):
                                                                          if op["block"] > stop:
                                                                              continue
                                                                      elif not use_block_num and stop is not None and isinstance(stop, int):
                                                                          if op["index"] > stop:
                                                          Severity: Major
                                                          Found in beem/snapshot.py and 1 other location - About 1 day to fix
                                                          beem/snapshot.py on lines 86..93

                                                          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 127.

                                                          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 isinstance(self.blockchain, Steem):
                                                                      sp_in = self.blockchain.vests_to_sp(sum_in, timestamp=ts)
                                                                      sp_out = self.blockchain.vests_to_sp(sum_out, timestamp=ts)
                                                                      sp_own = self.blockchain.vests_to_sp(own, timestamp=ts)
                                                                  else:
                                                          Severity: Major
                                                          Found in beem/snapshot.py and 1 other location - About 7 hrs to fix
                                                          beem/snapshot.py on lines 474..481

                                                          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 114.

                                                          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 isinstance(self.blockchain, Steem):
                                                                          sp_in = self.blockchain.vests_to_sp(sum_in, timestamp=ts)
                                                                          sp_out = self.blockchain.vests_to_sp(sum_out, timestamp=ts)
                                                                          sp_own = self.blockchain.vests_to_sp(own, timestamp=ts)
                                                                      else:
                                                          Severity: Major
                                                          Found in beem/snapshot.py and 1 other location - About 7 hrs to fix
                                                          beem/snapshot.py on lines 150..157

                                                          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 114.

                                                          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.vp[-1] == STEEM_100_PERCENT and ts - self.vp_timestamp[-1] > timedelta(seconds=1):
                                                                                  # Add charged VP just before new Vote
                                                                                  self.vp_timestamp.append(ts-timedelta(seconds=1))
                                                                                  self.vp.append(min([STEEM_100_PERCENT, self.vp[-1] + regenerated_vp]))
                                                          Severity: Major
                                                          Found in beem/snapshot.py and 1 other location - About 6 hrs to fix
                                                          beem/snapshot.py on lines 572..575

                                                          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 104.

                                                          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.vp[-1] == STEEM_100_PERCENT and ts - self.vp_timestamp[-1] > timedelta(seconds=1):
                                                                              # Add charged VP just before new Vote
                                                                              self.vp_timestamp.append(ts - timedelta(seconds=1))
                                                                              self.vp.append(min([STEEM_100_PERCENT, self.vp[-1] + regenerated_vp]))
                                                          Severity: Major
                                                          Found in beem/snapshot.py and 1 other location - About 6 hrs to fix
                                                          beem/snapshot.py on lines 547..550

                                                          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 104.

                                                          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 3 locations. Consider refactoring.
                                                          Open

                                                                              if self.vp[-1] > STEEM_100_PERCENT:
                                                                                  self.vp[-1] = STEEM_100_PERCENT
                                                                                  recharge_time = self.account.get_manabar_recharge_timedelta(
                                                                                      {"current_mana_pct": self.vp[-2] / 100})
                                                                                  # Add full VP once fully charged
                                                          Severity: Major
                                                          Found in beem/snapshot.py and 2 other locations - About 6 hrs to fix
                                                          beem/snapshot.py on lines 518..523
                                                          beem/snapshot.py on lines 566..571

                                                          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 98.

                                                          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 3 locations. Consider refactoring.
                                                          Open

                                                                          if self.vp[-1] > STEEM_100_PERCENT:
                                                                              self.vp[-1] = STEEM_100_PERCENT
                                                                              recharge_time = self.account.get_manabar_recharge_timedelta({"current_mana_pct": self.vp[-2] / 100})
                                                                              # Add full VP once fully charged
                                                                              self.vp_timestamp.append(self.vp_timestamp[-1] + recharge_time)
                                                          Severity: Major
                                                          Found in beem/snapshot.py and 2 other locations - About 6 hrs to fix
                                                          beem/snapshot.py on lines 518..523
                                                          beem/snapshot.py on lines 540..546

                                                          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 98.

                                                          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 3 locations. Consider refactoring.
                                                          Open

                                                                          if self.downvote_vp[-1] > STEEM_100_PERCENT:
                                                                              self.downvote_vp[-1] = STEEM_100_PERCENT
                                                                              recharge_time = self.account.get_manabar_recharge_timedelta({"current_mana_pct": self.downvote_vp[-2] / 100})
                                                                              # Add full downvote VP once fully charged
                                                                              self.downvote_vp_timestamp.append(self.downvote_vp_timestamp[-1] + recharge_time)
                                                          Severity: Major
                                                          Found in beem/snapshot.py and 2 other locations - About 6 hrs to fix
                                                          beem/snapshot.py on lines 540..546
                                                          beem/snapshot.py on lines 566..571

                                                          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 98.

                                                          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.account.get_voting_power() == 100:
                                                                      self.vp.append(10000)
                                                                      recharge_time = self.account.get_manabar_recharge_timedelta({"current_mana_pct": self.vp[-2] / 100})
                                                                      self.vp_timestamp.append(self.vp_timestamp[-1] + recharge_time)
                                                          Severity: Major
                                                          Found in beem/snapshot.py and 1 other location - About 4 hrs to fix
                                                          beem/snapshot.py on lines 587..591

                                                          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 83.

                                                          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.account.get_downvoting_power() == 100:
                                                                      self.downvote_vp.append(10000)
                                                                      recharge_time = self.account.get_manabar_recharge_timedelta(
                                                                          {"current_mana_pct": self.downvote_vp[-2] / 100})
                                                                      self.downvote_vp_timestamp.append(self.vp_timestamp[-1] + recharge_time)
                                                          Severity: Major
                                                          Found in beem/snapshot.py and 1 other location - About 4 hrs to fix
                                                          beem/snapshot.py on lines 582..585

                                                          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 83.

                                                          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 3 locations. Consider refactoring.
                                                          Open

                                                                              if self.vp[-1] < STEEM_100_PERCENT:
                                                                                  regenerated_vp = ((ts - self.vp_timestamp[
                                                                                      -1]).total_seconds()) * STEEM_100_PERCENT / STEEM_VOTE_REGENERATION_SECONDS
                                                                                  self.vp[-1] += int(regenerated_vp)
                                                          Severity: Major
                                                          Found in beem/snapshot.py and 2 other locations - About 3 hrs to fix
                                                          beem/snapshot.py on lines 514..516
                                                          beem/snapshot.py on lines 562..564

                                                          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 72.

                                                          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 3 locations. Consider refactoring.
                                                          Open

                                                                          if self.vp[-1] < STEEM_100_PERCENT:
                                                                              regenerated_vp = ((ts - self.vp_timestamp[-1]).total_seconds()) * STEEM_100_PERCENT / STEEM_VOTE_REGENERATION_SECONDS
                                                                              self.vp[-1] += int(regenerated_vp)
                                                          Severity: Major
                                                          Found in beem/snapshot.py and 2 other locations - About 3 hrs to fix
                                                          beem/snapshot.py on lines 514..516
                                                          beem/snapshot.py on lines 535..538

                                                          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 72.

                                                          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 3 locations. Consider refactoring.
                                                          Open

                                                                          if self.downvote_vp[-1] < STEEM_100_PERCENT:
                                                                              regenerated_vp = ((ts - self.downvote_vp_timestamp[-1]).total_seconds()) * STEEM_100_PERCENT / STEEM_VOTE_REGENERATION_SECONDS
                                                                              self.downvote_vp[-1] += int(regenerated_vp)
                                                          Severity: Major
                                                          Found in beem/snapshot.py and 2 other locations - About 3 hrs to fix
                                                          beem/snapshot.py on lines 535..538
                                                          beem/snapshot.py on lines 562..564

                                                          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 72.

                                                          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 3 locations. Consider refactoring.
                                                          Open

                                                                      fee_vests = self.blockchain.sp_to_vests(Amount(op['fee'], blockchain_instance=self.blockchain).amount, timestamp=ts)
                                                          Severity: Major
                                                          Found in beem/snapshot.py and 2 other locations - About 45 mins to fix
                                                          beem/snapshot.py on lines 296..297
                                                          beem/snapshot.py on lines 296..299

                                                          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 35.

                                                          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 3 locations. Consider refactoring.
                                                          Open

                                                                      if isinstance(self.blockchain, Steem):
                                                                          fee_vests = self.blockchain.sp_to_vests(Amount(op['fee'], blockchain_instance=self.blockchain).amount, timestamp=ts)
                                                          Severity: Major
                                                          Found in beem/snapshot.py and 2 other locations - About 45 mins to fix
                                                          beem/snapshot.py on lines 285..285
                                                          beem/snapshot.py on lines 296..299

                                                          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 35.

                                                          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 Amount(op['delegation'], blockchain_instance=self.blockchain).amount > 0:
                                                                              delegation = {'account': op['creator'], 'amount':
                                                                                            Amount(op['delegation'], blockchain_instance=self.blockchain)}
                                                          Severity: Minor
                                                          Found in beem/snapshot.py and 1 other location - About 35 mins to fix
                                                          beem/snapshot.py on lines 310..311

                                                          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 33.

                                                          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

                                                                          delegation = {'account': op['new_account_name'], 'amount':
                                                                                        Amount(op['delegation'], blockchain_instance=self.blockchain)}
                                                          Severity: Minor
                                                          Found in beem/snapshot.py and 1 other location - About 35 mins to fix
                                                          beem/snapshot.py on lines 301..303

                                                          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 33.

                                                          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