StellarCN/py-stellar-base

View on GitHub

Showing 79 of 2,412 total issues

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

    def from_xdr_object(
        cls, xdr_object: stellar_xdr.ClaimPredicate
    ) -> "ClaimPredicate":
        claim_predicate_type = xdr_object.type
        if (
Severity: Minor
Found in stellar_sdk/operation/create_claimable_balance.py - About 35 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

Avoid too many return statements within this function.
Open

            return cls.predicate_and(left, right)
Severity: Major
Found in stellar_sdk/operation/create_claimable_balance.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return None, None
    Severity: Major
    Found in stellar_sdk/sep/stellar_uri.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return ReturnHashMemo(value)
      Severity: Major
      Found in stellar_sdk/sep/stellar_uri.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return stellar_xdr.ClaimPredicate(
        Severity: Major
        Found in stellar_sdk/operation/create_claimable_balance.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                          return False
          Severity: Major
          Found in stellar_sdk/liquidity_pool_asset.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return asset_a.issuer < asset_b.issuer
            Severity: Major
            Found in stellar_sdk/liquidity_pool_asset.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return cls.predicate_or(left, right)
              Severity: Major
              Found in stellar_sdk/operation/create_claimable_balance.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return asset_a.code < asset_b.code
                Severity: Major
                Found in stellar_sdk/liquidity_pool_asset.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return stellar_xdr.ClaimPredicate(
                  Severity: Major
                  Found in stellar_sdk/operation/create_claimable_balance.py - About 30 mins to fix

                    Function _to_xdr_object has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def _to_xdr_object(
                            self,
                            xdr_asset: Union[
                                Type[stellar_xdr.Asset],
                                Type[stellar_xdr.ChangeTrustAsset],
                    Severity: Minor
                    Found in stellar_sdk/asset.py - About 25 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 append_create_contract_op has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def append_create_contract_op(
                            self,
                            wasm_id: Union[bytes, str],
                            address: Union[str, Address],
                            salt: Optional[bytes] = None,
                    Severity: Minor
                    Found in stellar_sdk/transaction_builder.py - About 25 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 from_txrep has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def from_txrep(
                        txrep: str, network_passphrase: str
                    ) -> Union[TransactionEnvelope, FeeBumpTransactionEnvelope]:
                        """Parse txrep and generate transaction envelope object.
                    
                    
                    Severity: Minor
                    Found in stellar_sdk/sep/txrep.py - About 25 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 is_fee_bump_transaction_envelope has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def is_fee_bump_transaction_envelope(xdr: Union[str, bytes]) -> bool:
                            if isinstance(xdr, str):
                                xdr_object = stellar_xdr.TransactionEnvelope.from_xdr(xdr)
                            else:
                                xdr_object = stellar_xdr.TransactionEnvelope.from_xdr_bytes(xdr)
                    Severity: Minor
                    Found in stellar_sdk/fee_bump_transaction_envelope.py - About 25 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 _get_raw_data_map has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def _get_raw_data_map(txrep: str) -> Dict[str, str]:
                        lines = txrep.strip().split("\n")
                        raw_data_map = {}
                        for line in lines:
                            if line.startswith(":") or len(line.strip()) == 0:
                    Severity: Minor
                    Found in stellar_sdk/sep/txrep.py - About 25 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 _get_check_memo_required_destinations has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def _get_check_memo_required_destinations(
                            self, transaction: Transaction
                        ) -> Generator[Tuple[int, str], Any, Any]:
                            destinations = set()
                            for index, operation in enumerate(transaction.operations):
                    Severity: Minor
                    Found in stellar_sdk/base_server.py - About 25 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 _get_preconditions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def _get_preconditions(raw_data_map: Dict[str, str], prefix: str) -> Preconditions:
                        preconditions_type = _get_value(raw_data_map, f"{prefix}type")
                        if preconditions_type == stellar_xdr.PreconditionType.PRECOND_TIME.name:
                            time_bounds = _get_time_bounds(raw_data_map, prefix)
                            return Preconditions(time_bounds=time_bounds)
                    Severity: Minor
                    Found in stellar_sdk/sep/txrep.py - About 25 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 authorize_entry has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def authorize_entry(
                        entry: Union[stellar_xdr.SorobanAuthorizationEntry, str],
                        signer: Union[Keypair, Callable[[stellar_xdr.HashIDPreimage], bytes]],
                        valid_until_ledger_sequence: int,
                        network_passphrase: str,
                    Severity: Minor
                    Found in stellar_sdk/auth.py - About 25 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 ed25519_signed_payload has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def ed25519_signed_payload(
                            cls, ed25519_signed_payload: Union[str, bytes, SignedPayloadSigner]
                        ) -> "SignerKey":
                            """Create ed25519 signed payload Signer from an ed25519 signed payload,
                            click `here <https://github.com/stellar/stellar-protocol/blob/master/core/cap-0040.md>`__ for more information.
                    Severity: Minor
                    Found in stellar_sdk/signer_key.py - About 25 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