dragonchain/dragonchain-sdk-python

View on GitHub

Showing 39 of 46 total issues

File dragonchain_client.py has 1290 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2020 Dragonchain, Inc. or its affiliates. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#     http://www.apache.org/licenses/LICENSE-2.0
Severity: Major
Found in dragonchain_sdk/dragonchain_client.py - About 3 days to fix

    Function _validate_and_build_custom_index_fields_array has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
    Open

    def _validate_and_build_custom_index_fields_array(  # noqa: C901
        custom_index_fields: Iterable["custom_index_fields_type"],
    ) -> List["custom_index_fields_type"]:
        """Validate a list of custom index fields and return a list which can be passed as a body for custom indexes to the chain
    
    
    Severity: Minor
    Found in dragonchain_sdk/dragonchain_client.py - About 1 day 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_smart_contract has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

        def update_smart_contract(  # noqa: C901
            self,
            smart_contract_id: str,
            image: Optional[str] = None,
            cmd: Optional[str] = None,
    Severity: Minor
    Found in dragonchain_sdk/dragonchain_client.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_smart_contract has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        def create_smart_contract(  # noqa: C901
            self,
            transaction_type: str,
            image: str,
            cmd: str,
    Severity: Minor
    Found in dragonchain_sdk/dragonchain_client.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

    File request.py has 256 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # Copyright 2020 Dragonchain, Inc. or its affiliates. All Rights Reserved.
    # Licensed under the Apache License, Version 2.0 (the "License");
    # you may not use this file except in compliance with the License.
    # You may obtain a copy of the License at
    #     http://www.apache.org/licenses/LICENSE-2.0
    Severity: Minor
    Found in dragonchain_sdk/request.py - About 2 hrs to fix

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

          def __init__(
              self, dragonchain_id: Optional[str] = None, auth_key: Optional[str] = None, auth_key_id: Optional[str] = None, algorithm: str = "SHA256"
          ):
              if dragonchain_id is None:
                  self.dragonchain_id = configuration.get_dragonchain_id()
      Severity: Minor
      Found in dragonchain_sdk/credentials.py - About 1 hr to fix

      Cognitive Complexity

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

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

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

      Further reading

      Function create_bitcoin_interchain has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def create_bitcoin_interchain(
              self,
              name: str,
              testnet: Optional[bool] = None,
              private_key: Optional[str] = None,
      Severity: Minor
      Found in dragonchain_sdk/dragonchain_client.py - About 1 hr to fix

      Cognitive Complexity

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

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

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

      Further reading

      Function update_binance_interchain has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def update_binance_interchain(
              self,
              name: str,
              testnet: Optional[bool] = None,
              private_key: Optional[str] = None,
      Severity: Minor
      Found in dragonchain_sdk/dragonchain_client.py - About 1 hr to fix

      Cognitive Complexity

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

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

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

      Further reading

      Function create_binance_interchain has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def create_binance_interchain(
              self,
              name: str,
              testnet: Optional[bool] = None,
              private_key: Optional[str] = None,
      Severity: Minor
      Found in dragonchain_sdk/dragonchain_client.py - About 1 hr to fix

      Cognitive Complexity

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

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

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

      Further reading

      Function update_bitcoin_interchain has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def update_bitcoin_interchain(
              self,
              name: str,
              testnet: Optional[bool] = None,
              private_key: Optional[str] = None,
      Severity: Minor
      Found in dragonchain_sdk/dragonchain_client.py - About 1 hr to fix

      Cognitive Complexity

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

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

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

      Further reading

      Function update_smart_contract has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def update_smart_contract(  # noqa: C901
              self,
              smart_contract_id: str,
              image: Optional[str] = None,
              cmd: Optional[str] = None,
      Severity: Minor
      Found in dragonchain_sdk/dragonchain_client.py - About 1 hr to fix

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

        def _build_ethereum_transaction_body(
            to: str, value: str, data: Optional[str] = None, gas_price: Optional[str] = None, gas: Optional[str] = None, nonce: Optional[str] = None
        ) -> Dict[str, Any]:
            """Build the json (dictionary) body for an ethereum transaction given its inputs
        
        
        Severity: Minor
        Found in dragonchain_sdk/dragonchain_client.py - About 1 hr to fix

        Cognitive Complexity

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

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

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

        Further reading

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

            def query_transactions(
                self,
                transaction_type: str,
                redisearch_query: str,
                verbatim: bool = False,
        Severity: Minor
        Found in dragonchain_sdk/dragonchain_client.py - About 1 hr to fix

        Cognitive Complexity

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

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

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

        Further reading

        Function create_smart_contract has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def create_smart_contract(  # noqa: C901
                self,
                transaction_type: str,
                image: str,
                cmd: str,
        Severity: Minor
        Found in dragonchain_sdk/dragonchain_client.py - About 1 hr to fix

          Function _make_request has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def _make_request(
          Severity: Major
          Found in dragonchain_sdk/request.py - About 50 mins to fix

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

                def get_smart_contract_logs(self, smart_contract_id: str, tail: Optional[int] = 100, since: Optional[str] = None) -> "request_response":
                    """Perform a query on a chain's smart contracts logs
            
                    Args:
                        smart_contract_id (str): Id of the contract to get
            Severity: Minor
            Found in dragonchain_sdk/dragonchain_client.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 _build_ethereum_transaction_body has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def _build_ethereum_transaction_body(
            Severity: Minor
            Found in dragonchain_sdk/dragonchain_client.py - About 45 mins to fix

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

                  def update_bitcoin_interchain(
              Severity: Minor
              Found in dragonchain_sdk/dragonchain_client.py - About 45 mins to fix

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

                    def create_binance_interchain(
                Severity: Minor
                Found in dragonchain_sdk/dragonchain_client.py - About 45 mins to fix

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

                      def query_blocks(
                  Severity: Minor
                  Found in dragonchain_sdk/dragonchain_client.py - About 45 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language