StellarCN/py-stellar-base

View on GitHub

Showing 97 of 2,517 total issues

TransactionBuilder has 61 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: Major
Found in stellar_sdk/transaction_builder.py - About 1 day to fix

    Function read_challenge_transaction has a Cognitive Complexity of 46 (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

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

        Function to_native has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

        def to_native(sc_val: Union[stellar_xdr.SCVal, bytes, str]) -> Union[
            bool,
            None,
            int,
            str,
        Severity: Minor
        Found in stellar_sdk/scval.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

        Keypair has 26 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 3 hrs to fix

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

          def _decode_check(version_byte: _VersionByte, encoded: str) -> bytes:
              encoded_data = encoded.encode("ascii")
              encoded_data = encoded_data + b"=" * ((8 - len(encoded_data) % 8) % 8)
          
              try:
          Severity: Minor
          Found in stellar_sdk/strkey.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 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 stream has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              def stream(
                  self, url: str, params: Dict[str, str] = None
              ) -> Generator[Dict[str, Any], None, None]:
                  """Creates an EventSource that listens for incoming messages from the server.
          
          
          Severity: Minor
          Found in stellar_sdk/client/requests_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

          Function to_xdr_object has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

              def to_xdr_object(self) -> stellar_xdr.Preconditions:
                  """Returns the xdr object for this Preconditions object.
          
                  :return: XDR Preconditions object
                  """
          Severity: Minor
          Found in stellar_sdk/preconditions.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: Sequence[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 from_xdr_object has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def from_xdr_object(cls, xdr_object: stellar_xdr.Preconditions) -> "Preconditions":
                  """Create a :class:`Preconditions` from an XDR Preconditions object.
          
                  :param xdr_object: The XDR LedgerBounds object.
                  :return: A new :class:`LedgerBounds` object from the given XDR LedgerBounds object.
          Severity: Minor
          Found in stellar_sdk/preconditions.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 sign_extra_signers_payload has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              def sign_extra_signers_payload(self, signer: Union[Keypair, str]) -> None:
                  """Sign this extra signers' payload with a given keypair.
          
                  Note that the signature must not already be in this instance's list of
                  signatures.
          Severity: Minor
          Found in stellar_sdk/transaction_envelope.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 from_xdr_object has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              def from_xdr_object(
                  cls,
                  xdr_object: Union[stellar_xdr.Transaction, stellar_xdr.TransactionV0],
                  v1: bool = True,
              ) -> "Transaction":
          Severity: Minor
          Found in stellar_sdk/transaction.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

                Severity
                Category
                Status
                Source
                Language