stellar/ruby-stellar-base

View on GitHub

Showing 11 of 29 total issues

Class Transaction has 27 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Transaction

    #
    # @see  Stellar::Operation.payment
    def self.payment(attributes={})
Severity: Minor
Found in lib/stellar/transaction.rb - About 3 hrs to fix

    File operation.rb has 273 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'bigdecimal'
    
    module Stellar
      class Operation
    
    
    Severity: Minor
    Found in lib/stellar/operation.rb - About 2 hrs to fix

      Class KeyPair has 22 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class KeyPair
          def self.from_seed(seed)
            seed_bytes = Util::StrKey.check_decode(:seed, seed)
            from_raw_seed seed_bytes
          end
      Severity: Minor
      Found in lib/stellar/key_pair.rb - About 2 hrs to fix

        Method initialize has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def initialize(
              source_account:, 
              sequence_number:, 
              base_fee: 100, 
              time_bounds: nil, 
        Severity: Minor
        Found in lib/stellar/transaction_builder.rb - 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

        Method manage_data has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.manage_data(attributes={})
              op = ManageDataOp.new()
        
              name  = attributes[:name]
              value = attributes[:value]
        Severity: Minor
        Found in lib/stellar/operation.rb - About 45 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 allow_trust has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.allow_trust(attributes={})
              op = AllowTrustOp.new()
        
              trustor = attributes[:trustor]
              authorize = attributes[:authorize]
        Severity: Minor
        Found in lib/stellar/operation.rb - 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

        Method change_trust has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.change_trust(attributes={})
              line = attributes[:line]
              if !line.is_a?(Asset)
                if !Asset::TYPES.include?(line[0])
                  fail ArgumentError, "must be one of #{Asset::TYPES}"
        Severity: Minor
        Found in lib/stellar/operation.rb - 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

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

            def self.path_payment_strict_send(attributes={})
              destination             = attributes[:destination]
              asset, dest_min         = get_asset_amount(attributes[:amount])
              send_asset, send_amount = get_asset_amount(attributes[:with])
              path                    = (attributes[:path] || []).map{
        Severity: Minor
        Found in lib/stellar/operation.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

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

            def make(thresholds={})
        
              # error if any of the needed components are not provided
              if COMPONENTS.any?{|c| thresholds[c].blank? }
                raise ArgumentError, "invalid thresholds hash, must have #{COMPONENTS.inspect} keys, had: #{thresholds.keys.inspect}"
        Severity: Minor
        Found in lib/stellar/thresholds.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

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

            def self.for_account(attributes={})
              account  = attributes[:account]
              sequence = attributes[:sequence]
              fee      = attributes[:fee]
        
        
        Severity: Minor
        Found in lib/stellar/transaction.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

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

            def self.path_payment_strict_receive(attributes={})
              destination             = attributes[:destination]
              asset, amount           = get_asset_amount(attributes[:amount])
              send_asset, send_max    = get_asset_amount(attributes[:with])
              path                    = (attributes[:path] || []).map{
        Severity: Minor
        Found in lib/stellar/operation.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

        Severity
        Category
        Status
        Source
        Language