astroband/ruby-stellar-sdk

View on GitHub
sdk/lib/stellar/sep10.rb

Summary

Maintainability
C
7 hrs
Test Coverage
A
96%

Method read_challenge_tx has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def self.read_challenge_tx(server:, challenge_xdr:, **options)
      envelope = Stellar::TransactionEnvelope.from_xdr(challenge_xdr, "base64")
      transaction = envelope.tx

      if transaction.seq_num != 0
Severity: Minor
Found in sdk/lib/stellar/sep10.rb - 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

Method build_challenge_tx has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def self.build_challenge_tx(server:, client:, domain: nil, timeout: 300, **options)
      if domain.blank? && options.key?(:anchor_name)
        ActiveSupport::Deprecation.new("next release", "stellar-sdk").warn <<~MSG
          SEP-10 v2.0.0 requires usage of service home domain instead of anchor name in the challenge transaction.
          Please update your implementation to use `Stellar::SEP10.build_challenge_tx(..., home_domain: 'example.com')`.
Severity: Minor
Found in sdk/lib/stellar/sep10.rb - About 1 hr to fix

    Method read_challenge_tx has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def self.read_challenge_tx(server:, challenge_xdr:, **options)
          envelope = Stellar::TransactionEnvelope.from_xdr(challenge_xdr, "base64")
          transaction = envelope.tx
    
          if transaction.seq_num != 0
    Severity: Minor
    Found in sdk/lib/stellar/sep10.rb - About 1 hr to fix

      Method verify_challenge_tx_signers has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.verify_challenge_tx_signers(server:, challenge_xdr:, signers:)
            raise InvalidSep10ChallengeError, "no signers provided" if signers.empty?
      
            te, _ = read_challenge_tx(server: server, challenge_xdr: challenge_xdr)
      
      
      Severity: Minor
      Found in sdk/lib/stellar/sep10.rb - 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

      Method build_challenge_tx has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.build_challenge_tx(server:, client:, domain: nil, timeout: 300, **options)
            if domain.blank? && options.key?(:anchor_name)
              ActiveSupport::Deprecation.new("next release", "stellar-sdk").warn <<~MSG
                SEP-10 v2.0.0 requires usage of service home domain instead of anchor name in the challenge transaction.
                Please update your implementation to use `Stellar::SEP10.build_challenge_tx(..., home_domain: 'example.com')`.
      Severity: Minor
      Found in sdk/lib/stellar/sep10.rb - 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

      There are no issues that match your filters.

      Category