holgern/beem

View on GitHub

Showing 683 of 2,332 total issues

Function sign_message has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

def sign_message(message, wif, hashfn=hashlib.sha256):
    """ Sign a digest with a wif key

        :param str wif: Private key in
    """
Severity: Minor
Found in beemgraphenebase/ecdsasig.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

Function benchmark_node has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

def benchmark_node(node, how_many_minutes=10, how_many_seconds=30):
    block_count = 0
    history_count = 0
    access_time = 0
    follow_time = 0
Severity: Minor
Found in examples/benchmark_nodes2.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

Function main has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

def main(args=None):
    
    args = parse_args(args)
    blockchain = args.blockchain
    
Severity: Minor
Found in examples/blockactivity.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

Function get_blog has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    def get_blog(self, start_entry_id=0, limit=100, raw_data=False, short_entries=False, account=None):
        """ Returns the list of blog entries for an account

            :param int start_entry_id: default is 0
            :param int limit: default is 100
Severity: Minor
Found in beem/account.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

Function get_list has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    def get_list(self, var="voter", voter=None, votee=None, start=None, stop=None, start_percent=None, stop_percent=None, sort_key="time", reverse=True):
        vote_list = []
        start = addTzInfo(start)
        stop = addTzInfo(stop)
        for vote in self.get_sorted_list(sort_key=sort_key, reverse=reverse):
Severity: Minor
Found in beem/vote.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

Function refresh has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    def refresh(self):
        """ Even though blocks never change, you freshly obtain its contents
            from an API with this method
        """
        if self.identifier is None:
Severity: Minor
Found in beem/block.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

Function create_claimed_account has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    def create_claimed_account(
        self,
        account_name,
        creator=None,
        owner_key=None,
Severity: Minor
Found in beem/blockchaininstance.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

TransactionBuilder has 33 functions (exceeds 20 allowed). Consider refactoring.
Open

class TransactionBuilder(dict):
    """ This class simplifies the creation of transactions by adding
        operations and signers.
        To build your own transactions and sign them

Severity: Minor
Found in beem/transactionbuilder.py - About 4 hrs to fix

    File bip32.py has 340 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    #!/usr/bin/env python
    #
    # Copyright 2014 Corgan Labs
    # See LICENSE.txt for distribution terms
    # https://github.com/namuyan/bip32nem/blob/master/bip32nem/BIP32Key.py
    Severity: Minor
    Found in beemgraphenebase/bip32.py - About 4 hrs to fix

      Function blog_history has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          def blog_history(self, limit=None, start=-1, reblogs=True, account=None):
              """ Stream the blog entries done by an account in reverse time order.
      
                  .. note:: RPC nodes keep a limited history of entries for the
                            user blog. Older blog posts of an account may not be available
      Severity: Minor
      Found in beem/account.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

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

          def __init__(self, authorperm, lazy=False, full=False, blockchain_instance=None, **kwargs):
              if blockchain_instance is None:
                  if kwargs.get("steem_instance"):
                      blockchain_instance = kwargs["steem_instance"]
                  elif kwargs.get("hive_instance"):
      Severity: Minor
      Found in beem/vote.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

      Function reply_history has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          def reply_history(self, limit=None, start_author=None,
                            start_permlink=None, account=None):
              """ Stream the replies to an account in reverse time order.
      
                  .. note:: RPC nodes keep a limited history of entries for the
      Severity: Minor
      Found in beem/account.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

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

          def __init__(self, amount, asset=None, fixed_point_arithmetic=False, new_appbase_format=True, blockchain_instance=None, **kwargs):
              self["asset"] = {}
              self.new_appbase_format = new_appbase_format
              self.fixed_point_arithmetic = fixed_point_arithmetic
              
      Severity: Minor
      Found in beem/amount.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

      Function encrypt has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

      def encrypt(receiver, memo, account, output, text, binary):
          """encrypt a (or more than one) memo text/file with the your memo key
      
          """
          if text and binary:
      Severity: Minor
      Found in beem/cli.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

      Function rpcexec has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          def rpcexec(self, payload):
              """ Execute a call by sending the payload.
                  It makes use of the GrapheneRPC library.
                  In here, we mostly deal with Steem specific error handling
      
      
      Severity: Minor
      Found in beemapi/noderpc.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

      Consider simplifying this complex logical expression.
      Open

              if re.search("Internal Server Error", reply) or re.search("500", reply):
                  raise RPCErrorDoRetry("Internal Server Error")
              elif re.search("Not Implemented", reply) or re.search("501", reply):
                  raise RPCError("Not Implemented")
              elif re.search("Bad Gateway", reply) or re.search("502", reply):
      Severity: Critical
      Found in beemapi/graphenerpc.py - About 4 hrs to fix

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

            def __init__(self, sort, account, observer="", limit=20, start_author="", start_permlink="", lazy=False, full=True, raw_data=False, blockchain_instance=None, **kwargs):
                if blockchain_instance is None:
                    if kwargs.get("steem_instance"):
                        blockchain_instance = kwargs["steem_instance"]
                    elif kwargs.get("hive_instance"):
        Severity: Minor
        Found in beem/comment.py - About 3 hrs to fix

        Cognitive Complexity

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

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

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

        Further reading

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

            def __init__(self, sort, tag="", observer="", limit=21, start_author="", start_permlink="", lazy=False, full=True, raw_data=False, blockchain_instance=None, **kwargs):
                if blockchain_instance is None:
                    if kwargs.get("steem_instance"):
                        blockchain_instance = kwargs["steem_instance"]
                    elif kwargs.get("hive_instance"):
        Severity: Minor
        Found in beem/comment.py - About 3 hrs to fix

        Cognitive Complexity

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

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

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

        Further reading

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

            def __init__(
                self,
                price=None,
                base=None,
                quote=None,
        Severity: Minor
        Found in beem/price.py - About 3 hrs to fix

        Cognitive Complexity

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

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

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

        Further reading

        Function create_account has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

            def create_account(
                self,
                account_name,
                creator=None,
                owner_key=None,
        Severity: Minor
        Found in beem/blockchaininstance.py - About 3 hrs to fix

        Cognitive Complexity

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

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

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

        Further reading

        Severity
        Category
        Status
        Source
        Language