inertia186/radiator

View on GitHub

Showing 67 of 1,476 total issues

Method method_missing has a Cognitive Complexity of 90 (exceeds 5 allowed). Consider refactoring.
Open

    def method_missing(m, *args, &block)
      super unless respond_to_missing?(m)
      
      current_rpc_id = rpc_id
      method_name = [api_name, m].join('.')
Severity: Minor
Found in lib/radiator/api.rb - About 1 day 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 blocks has a Cognitive Complexity of 90 (exceeds 5 allowed). Consider refactoring.
Open

    def blocks(start = nil, mode = :irreversible, max_blocks_per_node = MAX_BLOCKS_PER_NODE, &block)
      reset_api
      
      replay = !!start
      counter = 0
Severity: Minor
Found in lib/radiator/stream.rb - About 1 day 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

File api.rb has 669 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'uri'
require 'base64'
require 'hashie'
require 'hashie/logger'
require 'openssl'
Severity: Major
Found in lib/radiator/api.rb - About 1 day to fix

    Method method_missing has 149 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def method_missing(m, *args, &block)
          super unless respond_to_missing?(m)
          
          current_rpc_id = rpc_id
          method_name = [api_name, m].join('.')
    Severity: Major
    Found in lib/radiator/api.rb - About 5 hrs to fix

      Method method_missing has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
      Open

          def method_missing(m, *args, &block)
            super unless respond_to_missing?(m)
            
            @latest_values ||= []
            @latest_values.shift(5) if @latest_values.size > 20
      Severity: Minor
      Found in lib/radiator/stream.rb - About 5 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 operations has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
      Open

          def operations(type = nil, start = nil, mode = :irreversible, options = {include_virtual: false}, &block)
            type = [type].flatten.compact.map(&:to_sym)
            include_virtual = !!options[:include_virtual]
            
            if virtual_op_type?(type)
      Severity: Minor
      Found in lib/radiator/stream.rb - About 5 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 prepare has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
      Open

          def prepare
            raise TransactionError, "No wif or private key." unless !!@wif || !!@private_key
      
            @payload = nil
      
      
      Severity: Minor
      Found in lib/radiator/transaction.rb - About 5 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

      Class Api has 40 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class Api
          include Utils
          
          DEFAULT_STEEM_URL = 'https://api.steemit.com'
          
      Severity: Minor
      Found in lib/radiator/api.rb - About 5 hrs to fix

        Method parse_error_response has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

            def parse_error_response
              if response.nil?
                @expiry = false
                @can_retry = false
                @can_reprepare = false
        Severity: Minor
        Found in lib/radiator/error_parser.rb - About 4 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 finalize has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.finalize(api, network_broadcast_api, self_logger, logger)
              proc {
                if !!api && !api.stopped?
                  puts "DESTROY: #{api.inspect}" if ENV['LOG'] == 'TRACE'
                  api.shutdown
        Severity: Minor
        Found in lib/radiator/transaction.rb - About 4 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 parse_error_response has 98 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def parse_error_response
              if response.nil?
                @expiry = false
                @can_retry = false
                @can_reprepare = false
        Severity: Major
        Found in lib/radiator/error_parser.rb - About 3 hrs to fix

          Method shutdown has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
          Open

              def shutdown
                @uri = nil
                @http_id = nil
                @http_memo.each do |k|
                  v = @http_memo.delete(k)
          Severity: Minor
          Found in lib/radiator/api.rb - About 3 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 blocks has 94 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def blocks(start = nil, mode = :irreversible, max_blocks_per_node = MAX_BLOCKS_PER_NODE, &block)
                reset_api
                
                replay = !!start
                counter = 0
          Severity: Major
          Found in lib/radiator/stream.rb - About 3 hrs to fix

            Method handle_error has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

                def handle_error(response, request_options, method_name, tries)
                  parser = ErrorParser.new(response)
                  _signatures, exp = extract_signatures(request_options)
                  
                  if (!!exp && exp < Time.now.utc) || (tries > 2 && !parser.node_degraded?)
            Severity: Minor
            Found in lib/radiator/api.rb - About 3 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

            File stream.rb has 309 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            module Radiator
              # Radiator::Stream allows a live view of the STEEM blockchain.
              # 
              # All values returned by `get_dynamic_global_properties` can be streamed.
              # 
            Severity: Minor
            Found in lib/radiator/stream.rb - About 3 hrs to fix

              Method default_failover_urls has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
              Open

                  def self.default_failover_urls(chain)
                    case chain.to_sym
                    when :steem, :hive
                      begin
                        _api = Radiator::Api.new(url: DEFAULT_HIVE_FAILOVER_URLS.sample, failover_urls: DEFAULT_HIVE_FAILOVER_URLS)
              Severity: Minor
              Found in lib/radiator/api.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 initialize has 68 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def initialize(options = {})
                    @user = options[:user]
                    @password = options[:password]
                    @chain = (options[:chain] || 'hive').to_sym
                    @url = options[:url] || Api::default_url(@chain)
              Severity: Major
              Found in lib/radiator/api.rb - About 2 hrs to fix

                File transaction.rb has 269 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                require 'bitcoin'
                require 'digest'
                require 'time'
                
                module Radiator
                Severity: Minor
                Found in lib/radiator/transaction.rb - About 2 hrs to fix

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

                    class Chain
                      include Mixins::ActsAsPoster
                      include Mixins::ActsAsVoter
                      include Mixins::ActsAsWallet
                      
                  Severity: Minor
                  Found in lib/radiator/chain.rb - About 2 hrs to fix

                    Method process has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def process(broadcast = false)
                          prepare
                    
                          if broadcast
                            loop do
                    Severity: Minor
                    Found in lib/radiator/transaction.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

                    Severity
                    Category
                    Status
                    Source
                    Language