StellarCN/py-stellar-base

View on GitHub

Showing 67 of 1,842 total issues

Function read_challenge_transaction has a Cognitive Complexity of 51 (exceeds 5 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 7 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 48 functions (exceeds 20 allowed). Consider refactoring.
Open

class TransactionBuilder:
    """Transaction builder helps constructs a new :class:`TransactionEnvelope
    <stellar_sdk.transaction_envelope.TransactionEnvelope>` using the given
    :class:`Account <stellar_sdk.account.Account>` as the transaction's "source account". The transaction will use
    the current sequence number of the given account as its sequence number and increment the given account's
Severity: Minor
Found in stellar_sdk/transaction_builder.py - About 6 hrs to fix

    BaseServer has 28 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class BaseServer:
        def submit_transaction(
            self,
            transaction_envelope: Union[
                TransactionEnvelope, FeeBumpTransactionEnvelope, str
    Severity: Minor
    Found in stellar_sdk/base_server.py - About 3 hrs to fix

      Server has 27 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Server(BaseServer):
          """Server handles the network connection to a `Horizon <https://developers.stellar.org/api/introduction/>`_
          instance and exposes an interface for requests to that instance.
      
          An example::
      Severity: Minor
      Found in stellar_sdk/server.py - About 3 hrs to fix

        Keypair has 24 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Keypair:
            """The :class:`Keypair` object, which represents a signing and
            verifying key for use with the Stellar network.
        
            Instead of instantiating the class directly, we recommend using one of
        Severity: Minor
        Found in stellar_sdk/keypair.py - About 2 hrs to fix

          Function verify_challenge_transaction_signers has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

          def verify_challenge_transaction_signers(
              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 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

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

              def from_xdr_object(cls, xdr_object: stellar_xdr.Operation) -> "RevokeSponsorship":
                  """Creates a :class:`RevokeSponsorship` object from an XDR Operation
                  object.
                  """
                  source = Operation.get_source_from_xdr_obj(xdr_object)
          Severity: Minor
          Found in stellar_sdk/operation/revoke_sponsorship.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 _verify_transaction_signatures has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

          def _verify_transaction_signatures(
              transaction_envelope: TransactionEnvelope, signers: List[Ed25519PublicKeySigner]
          ) -> List[Ed25519PublicKeySigner]:
              """Checks if a transaction has been signed by one or more of
              the signers, returning a list of signers that were found to have signed the
          Severity: Minor
          Found in stellar_sdk/sep/stellar_web_authentication.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 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 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 __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 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 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/sep/stellar_uri.py - About 1 hr to fix

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

                        Severity
                        Category
                        Status
                        Source
                        Language