StellarCN/py-stellar-base

View on GitHub

Showing 97 of 2,517 total issues

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/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 __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 _assemble_transaction has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def _assemble_transaction(
              transaction_envelope: TransactionEnvelope,
              simulation: SimulateTransactionResponse,
          ) -> TransactionEnvelope:
              # TODO: add support for FeeBumpTransactionEnvelope
          Severity: Minor
          Found in stellar_sdk/base_soroban_server.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 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_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 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 __init__ has 8 arguments (exceeds 5 allowed). Consider refactoring.
          Open

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

            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 __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 7 arguments (exceeds 5 allowed). Consider refactoring.
                  Open

                      def __init__(
                  Severity: Major
                  Found in stellar_sdk/operation/path_payment_strict_receive.py - About 45 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/aiohttp_client.py - About 45 mins to fix

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

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

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

                                def __check_memo_required_sync(
                                    self, transaction: Union[Transaction, FeeBumpTransaction]
                                ) -> None:
                                    if isinstance(transaction, FeeBumpTransaction):
                                        transaction = transaction.inner_transaction_envelope.transaction
                            Severity: Minor
                            Found in stellar_sdk/server.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

                            Severity
                            Category
                            Status
                            Source
                            Language