StellarCN/py-stellar-base

View on GitHub

Showing 1,842 of 1,842 total issues

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

    def is_valid_lexicographic_order(asset_a: Asset, asset_b: Asset) -> bool:
        """Compares if asset_a < asset_b according with the criteria:

        1. First compare the type (eg. native before alphanum4 before alphanum12).
        2. If the types are equal, compare the assets codes.
Severity: Minor
Found in stellar_sdk/liquidity_pool_asset.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 read_challenge_transaction has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def read_challenge_transaction(
    challenge_transaction: str,
    server_account_id: str,
    home_domains: Union[str, Iterable[str]],
    web_auth_domain: str,
Severity: Minor
Found in stellar_sdk/sep/stellar_web_authentication.py - About 1 hr to fix

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

        def __init__(
    Severity: Major
    Found in stellar_sdk/operation/set_options.py - About 1 hr to fix

      Function append_set_options_op has 10 arguments (exceeds 5 allowed). Consider refactoring.
      Open

          def append_set_options_op(
      Severity: Major
      Found in stellar_sdk/transaction_builder.py - About 1 hr to fix

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

            def from_xdr_object(cls, xdr_object) -> "SetOptions":
                """Creates a :class:`SetOptions` object from an XDR Operation
                object.
        
                """
        Severity: Minor
        Found in stellar_sdk/operation/set_options.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 example_verify_challenge_tx_threshold has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        def example_verify_challenge_tx_threshold():
            # Server builds challenge transaction
            challenge_tx = build_challenge_transaction(
                server_keypair.secret,
                client_master_keypair.public_key,
        Severity: Minor
        Found in examples/transaction_challenge.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 __init__ has 9 arguments (exceeds 5 allowed). Consider refactoring.
        Open

            def __init__(
        Severity: Major
        Found in stellar_sdk/operation/revoke_sponsorship.py - About 1 hr to fix

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

              def __init__(
          Severity: Major
          Found in stellar_sdk/sep/stellar_uri.py - About 1 hr to fix

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

                def __init__(
            Severity: Major
            Found in stellar_sdk/sep/stellar_uri.py - About 1 hr to fix

              Function build_challenge_transaction has 9 arguments (exceeds 5 allowed). Consider refactoring.
              Open

              def build_challenge_transaction(
              Severity: Major
              Found in stellar_sdk/sep/stellar_web_authentication.py - About 1 hr to fix

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

                def best_rational_approximation(x) -> Dict[str, int]:
                    x = Decimal(x)
                    int32_max = Decimal(2147483647)
                    fractions = [[Decimal(0), Decimal(1)], [Decimal(1), Decimal(0)]]
                    i = 2
                Severity: Minor
                Found in stellar_sdk/utils.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 to_txrep has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                def to_txrep(
                    transaction_envelope: Union[TransactionEnvelope, FeeBumpTransactionEnvelope],
                ) -> str:
                    """Generate a human-readable format for Stellar transactions.
                
                
                Severity: Minor
                Found in stellar_sdk/sep/txrep.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 to_uri has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def to_uri(self) -> str:
                        """Generate the request URI.
                
                        :return: Stellar Pay URI.
                        """
                Severity: Minor
                Found in stellar_sdk/sep/stellar_uri.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 _to_operation_body has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def _to_operation_body(self) -> stellar_xdr.OperationBody:
                        inflation_dest = (
                            Keypair.from_public_key(self.inflation_dest).xdr_account_id()
                            if self.inflation_dest is not None
                            else None
                Severity: Minor
                Found in stellar_sdk/operation/set_options.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 __init__ has 8 arguments (exceeds 5 allowed). Consider refactoring.
                Open

                    def __init__(

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

                      def __init__(

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

                        def __init__(
                    Severity: Major
                    Found in stellar_sdk/client/requests_client.py - About 50 mins to fix

                      Function verify_challenge_transaction_threshold has 7 arguments (exceeds 5 allowed). Consider refactoring.
                      Open

                      def verify_challenge_transaction_threshold(
                      Severity: Major
                      Found in stellar_sdk/sep/stellar_web_authentication.py - About 45 mins to fix

                        Function append_path_payment_strict_receive_op has 7 arguments (exceeds 5 allowed). Consider refactoring.
                        Open

                            def append_path_payment_strict_receive_op(
                        Severity: Major
                        Found in stellar_sdk/transaction_builder.py - About 45 mins to fix

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

                              def __init__(
                          Severity: Major
                          Found in stellar_sdk/client/requests_client.py - About 45 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language