holgern/beem

View on GitHub
beem/blurt.py

Summary

Maintainability
F
2 wks
Test Coverage
F
51%

File blurt.py has 352 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
import json
import logging
import re
import os
Severity: Minor
Found in beem/blurt.py - About 4 hrs to fix

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

        def rshares_to_vote_pct(self, rshares, post_rshares=0, steem_power=None, vests=None, voting_power=STEEM_100_PERCENT, use_stored_data=True):
            """ Obtain the voting percentage for a desired rshares value
                for a given Steem Power or vesting shares and voting_power
                Give either steem_power or vests, not both.
                When the output is greater than 10000 or less than -10000,
    Severity: Minor
    Found in beem/blurt.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

    Blurt has 26 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Blurt(BlockChainInstance):
        """ Connect to the Blurt network.
    
            :param str node: Node to connect to *(optional)*
            :param str rpcuser: RPC user *(optional)*
    Severity: Minor
    Found in beem/blurt.py - About 3 hrs to fix

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

          def get_blurt_per_mvest(self, time_stamp=None, use_stored_data=True):
              """ Returns the MVEST to BLURT ratio
      
                  :param int time_stamp: (optional) if set, return an estimated
                      BLURT per MVEST ratio for the given time stamp. If unset the
      Severity: Minor
      Found in beem/blurt.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 bbd_to_rshares. (6)
      Open

          def bbd_to_rshares(self, sbd, not_broadcasted_vote=False, use_stored_data=True):
              """ Obtain the r-shares from SBD
      
              :param sbd: SBD
              :type sbd: str, int, amount.Amount
      Severity: Minor
      Found in beem/blurt.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 rshares_to_vote_pct has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def rshares_to_vote_pct(self, rshares, post_rshares=0, steem_power=None, vests=None, voting_power=STEEM_100_PERCENT, use_stored_data=True):
              """ Obtain the voting percentage for a desired rshares value
                  for a given Steem Power or vesting shares and voting_power
                  Give either steem_power or vests, not both.
                  When the output is greater than 10000 or less than -10000,
      Severity: Minor
      Found in beem/blurt.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 bbd_to_vote_pct has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def bbd_to_vote_pct(self, sbd, post_rshares=0, steem_power=None, vests=None, voting_power=STEEM_100_PERCENT, not_broadcasted_vote=True, use_stored_data=True):
      Severity: Major
      Found in beem/blurt.py - About 50 mins to fix

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

            def bp_to_bbd(self, sp, post_rshares=0, voting_power=STEEM_100_PERCENT, vote_pct=STEEM_100_PERCENT, not_broadcasted_vote=True, use_stored_data=True):
        Severity: Minor
        Found in beem/blurt.py - About 45 mins to fix

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

              def rshares_to_vote_pct(self, rshares, post_rshares=0, steem_power=None, vests=None, voting_power=STEEM_100_PERCENT, use_stored_data=True):
          Severity: Minor
          Found in beem/blurt.py - About 45 mins to fix

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

                def get_blurt_per_mvest(self, time_stamp=None, use_stored_data=True):
                    """ Returns the MVEST to BLURT ratio
            
                        :param int time_stamp: (optional) if set, return an estimated
                            BLURT per MVEST ratio for the given time stamp. If unset the
            Severity: Minor
            Found in beem/blurt.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

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

                def token_power_to_token_backed_dollar(self, token_power, post_rshares=0, voting_power=STEEM_100_PERCENT, vote_pct=STEEM_100_PERCENT, not_broadcasted_vote=True, use_stored_data=True):
            Severity: Minor
            Found in beem/blurt.py - About 45 mins to fix

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

                  def vests_to_bbd(self, vests, post_rshares=0, voting_power=STEEM_100_PERCENT, vote_pct=STEEM_100_PERCENT, not_broadcasted_vote=True, use_stored_data=True):
              Severity: Minor
              Found in beem/blurt.py - About 45 mins to fix

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

                    def vests_to_rshares(self, vests, post_rshares=0, voting_power=STEEM_100_PERCENT, vote_pct=STEEM_100_PERCENT, subtract_dust_threshold=True, use_stored_data=True):
                Severity: Minor
                Found in beem/blurt.py - About 45 mins to fix

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

                      def bp_to_rshares(self, steem_power, post_rshares=0, voting_power=STEEM_100_PERCENT, vote_pct=STEEM_100_PERCENT, use_stored_data=True):
                  Severity: Minor
                  Found in beem/blurt.py - About 35 mins to fix

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

                        def bbd_to_rshares(self, sbd, not_broadcasted_vote=False, use_stored_data=True):
                            """ Obtain the r-shares from SBD
                    
                            :param sbd: SBD
                            :type sbd: str, int, amount.Amount
                    Severity: Minor
                    Found in beem/blurt.py - About 25 mins to fix

                    Cognitive Complexity

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

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

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

                    Further reading

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

                        def bbd_to_vote_pct(self, sbd, post_rshares=0, steem_power=None, vests=None, voting_power=STEEM_100_PERCENT, not_broadcasted_vote=True, use_stored_data=True):
                    Severity: Major
                    Found in beem/blurt.py by sonar-python

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

                    Noncompliant Code Example

                    With a maximum number of 4 parameters:

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

                    Compliant Solution

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

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

                                sbd = Amount(sbd, blockchain_instance=self)
                    Severity: Major
                    Found in beem/blurt.py by sonar-python

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

                    Noncompliant Code Example

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

                    Compliant Solution

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

                    or

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

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

                                sbd = Amount(sbd, blockchain_instance=self)
                    Severity: Major
                    Found in beem/blurt.py by sonar-python

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

                    Noncompliant Code Example

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

                    Compliant Solution

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

                    or

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

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

                                rshares = math.copysign(self._calc_revert_vote_claim(abs(rshares), post_rshares), rshares)
                    Severity: Major
                    Found in beem/blurt.py by sonar-python

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

                    Noncompliant Code Example

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

                    Compliant Solution

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

                    or

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

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

                        def rshares_to_vote_pct(self, rshares, post_rshares=0, steem_power=None, vests=None, voting_power=STEEM_100_PERCENT, use_stored_data=True):
                            """ Obtain the voting percentage for a desired rshares value
                                for a given Steem Power or vesting shares and voting_power
                                Give either steem_power or vests, not both.
                                When the output is greater than 10000 or less than -10000,
                    Severity: Major
                    Found in beem/blurt.py and 2 other locations - About 4 days to fix
                    beem/hive.py on lines 329..369
                    beem/steem.py on lines 348..388

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

                    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

                        def bbd_to_rshares(self, sbd, not_broadcasted_vote=False, use_stored_data=True):
                            """ Obtain the r-shares from SBD
                    
                            :param sbd: SBD
                            :type sbd: str, int, amount.Amount
                    Severity: Major
                    Found in beem/blurt.py and 2 other locations - About 2 days to fix
                    beem/hive.py on lines 284..327
                    beem/steem.py on lines 303..346

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

                    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

                        def get_blurt_per_mvest(self, time_stamp=None, use_stored_data=True):
                            """ Returns the MVEST to BLURT ratio
                    
                                :param int time_stamp: (optional) if set, return an estimated
                                    BLURT per MVEST ratio for the given time stamp. If unset the
                    Severity: Major
                    Found in beem/blurt.py and 1 other location - About 1 day to fix
                    beem/hive.py on lines 162..187

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

                    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

                        def bbd_to_vote_pct(self, sbd, post_rshares=0, steem_power=None, vests=None, voting_power=STEEM_100_PERCENT, not_broadcasted_vote=True, use_stored_data=True):
                            """ Obtain the voting percentage for a desired SBD value
                                for a given Steem Power or vesting shares and voting power
                                Give either Steem Power or vests, not both.
                                When the output is greater than 10000 or smaller than -10000,
                    Severity: Major
                    Found in beem/blurt.py and 2 other locations - About 1 day to fix
                    beem/hive.py on lines 371..398
                    beem/steem.py on lines 390..417

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

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

                        def vests_to_rshares(self, vests, post_rshares=0, voting_power=STEEM_100_PERCENT, vote_pct=STEEM_100_PERCENT, subtract_dust_threshold=True, use_stored_data=True):
                            """ Obtain the r-shares from vests
                    
                                :param number vests: vesting shares
                                :param int post_rshares: rshares of post which is voted
                    Severity: Major
                    Found in beem/blurt.py and 2 other locations - About 1 day to fix
                    beem/hive.py on lines 265..282
                    beem/steem.py on lines 284..301

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

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

                        @property
                        def hardfork(self):
                            if self.offline or self.rpc is None:
                                versions = known_chains['BLURT']['min_version']
                            else:
                    Severity: Major
                    Found in beem/blurt.py and 3 other locations - About 6 hrs to fix
                    beem/blockchaininstance.py on lines 753..763
                    beem/hive.py on lines 407..417
                    beem/steem.py on lines 426..436

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

                        def _calc_resulting_vote(self, voting_power=STEEM_100_PERCENT, vote_pct=STEEM_100_PERCENT, use_stored_data=True):
                            # determine voting power used
                            used_power = int((voting_power * abs(vote_pct)) / STEEM_100_PERCENT * (60 * 60 * 24))
                            max_vote_denom = self._max_vote_denom(use_stored_data=use_stored_data)
                            used_power = int((used_power + max_vote_denom - 1) / max_vote_denom)
                    Severity: Major
                    Found in beem/blurt.py and 2 other locations - About 6 hrs to fix
                    beem/blockchaininstance.py on lines 604..609
                    beem/steem.py on lines 264..269

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

                    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

                        def get_network(self, use_stored_data=True, config=None):
                            """ Identify the network
                    
                                :param bool use_stored_data: if True, stored data will be returned. If stored data are
                                                             empty or old, refresh_data() is used.
                    Severity: Major
                    Found in beem/blurt.py and 2 other locations - About 5 hrs to fix
                    beem/hive.py on lines 114..132
                    beem/steem.py on lines 112..130

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

                    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

                        def bp_to_bbd(self, sp, post_rshares=0, voting_power=STEEM_100_PERCENT, vote_pct=STEEM_100_PERCENT, not_broadcasted_vote=True, use_stored_data=True):
                            """ Obtain the resulting equivalent BBD vote value from Blurt power
                    
                                :param number steem_power: Blurt Power
                                :param int post_rshares: rshares of post which is voted
                    Severity: Major
                    Found in beem/blurt.py and 2 other locations - About 3 hrs to fix
                    beem/hive.py on lines 221..234
                    beem/steem.py on lines 227..240

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

                    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

                        def vests_to_bp(self, vests, timestamp=None, use_stored_data=True):
                            """ Converts vests to BP
                    
                                :param amount.Amount vests/float vests: Vests to convert
                                :param int timestamp: (Optional) Can be used to calculate
                    Severity: Major
                    Found in beem/blurt.py and 2 other locations - About 3 hrs to fix
                    beem/hive.py on lines 191..201
                    beem/steem.py on lines 194..204

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 62.

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

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

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

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

                    Refactorings

                    Further Reading

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

                        def bp_to_rshares(self, steem_power, post_rshares=0, voting_power=STEEM_100_PERCENT, vote_pct=STEEM_100_PERCENT, use_stored_data=True):
                            """ Obtain the r-shares from Steem power
                    
                                :param number steem_power: Steem Power
                                :param int post_rshares: rshares of post which is voted
                    Severity: Major
                    Found in beem/blurt.py and 1 other location - About 2 hrs to fix
                    beem/steem.py on lines 271..282

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

                    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

                        def vests_to_bbd(self, vests, post_rshares=0, voting_power=STEEM_100_PERCENT, vote_pct=STEEM_100_PERCENT, not_broadcasted_vote=True, use_stored_data=True):
                            """ Obtain the resulting BBD vote value from vests
                    
                                :param number vests: vesting shares
                                :param int post_rshares: rshares of post which is voted
                    Severity: Major
                    Found in beem/blurt.py and 2 other locations - About 2 hrs to fix
                    beem/hive.py on lines 236..249
                    beem/steem.py on lines 242..255

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

                    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

                        def rshares_to_bbd(self, rshares, not_broadcasted_vote=False, use_stored_data=True):
                            """ Calculates the current SBD value of a vote
                            """
                            payout = float(rshares) * self.get_bbd_per_rshares(use_stored_data=use_stored_data,
                                                                               not_broadcasted_vote_rshares=rshares if not_broadcasted_vote else 0)
                    Severity: Major
                    Found in beem/blurt.py and 2 other locations - About 2 hrs to fix
                    beem/hive.py on lines 137..142
                    beem/steem.py on lines 135..140

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

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

                        def _max_vote_denom(self, use_stored_data=True):
                            # get props
                            global_properties = self.get_dynamic_global_properties(use_stored_data=use_stored_data)
                            vote_power_reserve_rate = global_properties['vote_power_reserve_rate']
                            max_vote_denom = vote_power_reserve_rate * STEEM_VOTE_REGENERATION_SECONDS
                    Severity: Major
                    Found in beem/blurt.py and 2 other locations - About 1 hr to fix
                    beem/blockchaininstance.py on lines 597..602
                    beem/steem.py on lines 257..262

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 47.

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

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

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

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

                    Refactorings

                    Further Reading

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

                        @property
                        def chain_params(self):
                            if self.offline or self.rpc is None:
                                return known_chains["BLURT"]
                            else:
                    Severity: Major
                    Found in beem/blurt.py and 3 other locations - About 1 hr to fix
                    beem/blockchaininstance.py on lines 746..751
                    beem/hive.py on lines 400..405
                    beem/steem.py on lines 419..424

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

                    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

                        @property
                        def is_blurt(self):
                            config = self.get_config()
                            if config is None:
                                return True
                    Severity: Major
                    Found in beem/blurt.py and 2 other locations - About 1 hr to fix
                    beem/hive.py on lines 419..424
                    beem/steem.py on lines 438..443

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

                    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

                        def token_power_to_token_backed_dollar(self, token_power, post_rshares=0, voting_power=STEEM_100_PERCENT, vote_pct=STEEM_100_PERCENT, not_broadcasted_vote=True, use_stored_data=True):
                            return self.bp_to_bbd(token_power, post_rshares=post_rshares, voting_power=voting_power, vote_pct=vote_pct, not_broadcasted_vote=not_broadcasted_vote, use_stored_data=use_stored_data)
                    Severity: Major
                    Found in beem/blurt.py and 2 other locations - About 1 hr to fix
                    beem/hive.py on lines 218..219
                    beem/steem.py on lines 224..225

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

                    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

                        def bp_to_vests(self, sp, timestamp=None, use_stored_data=True):
                            """ Converts BP to vests
                    
                                :param float bp: Blurt power to convert
                                :param datetime timestamp: (Optional) Can be used to calculate
                    Severity: Major
                    Found in beem/blurt.py and 2 other locations - About 1 hr to fix
                    beem/hive.py on lines 206..213
                    beem/steem.py on lines 206..213

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

                    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