StellarCN/py-stellar-base

View on GitHub

Showing 1,842 of 1,842 total issues

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

    def _encode_memo(memo) -> Union[Tuple[str, Union[str, int]], Tuple[None, None]]:
        if memo and not isinstance(memo, NoneMemo):
            if isinstance(memo, TextMemo):
                memo_text = memo.memo_text.decode()  # memo text cant decode?
                memo_type = "MEMO_TEXT"
Severity: Minor
Found in stellar_sdk/sep/stellar_uri.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

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

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

    def _decode_memo(
        memo_type: Optional[str], memo_value: Optional[str]
    ) -> Optional[Memo]:
        if memo_type is None:
            return None
Severity: Minor
Found in stellar_sdk/sep/stellar_uri.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 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 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 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

            Severity: Major
            Found in stellar_sdk/sep/txrep.py - About 30 mins to fix

              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 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 None, None
                    Severity: Major
                    Found in stellar_sdk/sep/stellar_uri.py - About 30 mins to fix

                      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 _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 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 from_txrep has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      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_raw_data_map has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      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_memo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      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

                      Line too long (93 > 79 characters)
                      Open

                      This example shows how to transfer the native balance (the amount of XLM an account holds) to
                      Severity: Minor
                      Found in examples/account_merge.py by pep8

                      Limit all lines to a maximum of 79 characters.

                      There are still many devices around that are limited to 80 character
                      lines; plus, limiting windows to 80 characters makes it possible to
                      have several windows side-by-side.  The default wrapping on such
                      devices looks ugly.  Therefore, please limit all lines to a maximum
                      of 79 characters. For flowing long blocks of text (docstrings or
                      comments), limiting the length to 72 characters is recommended.
                      
                      Reports error E501.
                      Severity
                      Category
                      Status
                      Source
                      Language