infertux/ubea

View on GitHub

Showing 7 of 16 total issues

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

      def post_private(method, params = {})
        params['nonce'] = nonce

        response = retryable_http_request do
          http_adapter("https://api.kraken.com").post(url_path(method), params) do |request|
Severity: Minor
Found in lib/ubea/exchanges/kraken_base.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 to_s has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def to_s(with_currency: true, auto_format: true, tooltip_currency: false)
      amount = dup
      currency = self.currency.dup

      old_amount_string = if tooltip_currency
Severity: Minor
Found in lib/ubea/money.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 post_private has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def post_private(method, params = {})
        params['method'] = method
        params['nonce'] = nonce

        response = retryable_http_request do
Severity: Minor
Found in lib/ubea/exchanges/bitcoin_co_id_idr.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 trade! has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def trade!(args, simulate: false)
        params = {
          pair: "XXBTZ#{fiat_currency}",
          type: args.fetch(:type),
          volume: args.fetch(:volume),
Severity: Minor
Found in lib/ubea/exchanges/kraken_base.rb - About 1 hr to fix

    Method to_s has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def to_s(with_currency: true, auto_format: true, tooltip_currency: false)
          amount = dup
          currency = self.currency.dup
    
          old_amount_string = if tooltip_currency
    Severity: Minor
    Found in lib/ubea/money.rb - About 1 hr to fix

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

          def best_offer_price_for_fiat_amount(type, fiat_amount, fiat_currency)
            total_fiat_amount = 0
            good_offers = []
      
            offers = public_send(type).dup # asks or bids
      Severity: Minor
      Found in lib/ubea/order_book.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 rate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.rate(from, to)
            pair = [from, to].join
      
            if @rates[pair].nil? || @rates[pair].updated_at < Time.now - 10 * 60
      
      
      Severity: Minor
      Found in lib/ubea/currency_converter.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