inertia186/radiator

View on GitHub

Showing 1,476 of 1,476 total issues

Method has too many lines. [20/10]
Open

      def http
        @http ||= if persist?
          if defined? Net::HTTP::Persistent::DEFAULT_POOL_SIZE
            Net::HTTP::Persistent.new(name: http_id, pool_size: @pool_size).tap do |http|
              http.keep_alive = 30

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Cyclomatic complexity for shutdown is too high. [16/6]
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 by rubocop

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Method has too many lines. [20/10]
Open

    def http
      return @http_memo[http_id] if @http_memo.keys.include? http_id
      
      @http_memo[http_id] = if @persist && @persist_error_count < 10
        idempotent = api_name != :network_broadcast_api
Severity: Minor
Found in lib/radiator/api.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Cyclomatic complexity for initialize is too high. [16/6]
Open

    def initialize(options = {})
      @user = options[:user]
      @password = options[:password]
      @chain = (options[:chain] || 'hive').to_sym
      @url = options[:url] || Api::default_url(@chain)
Severity: Minor
Found in lib/radiator/api.rb by rubocop

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Cyclomatic complexity for post is too high. [16/6]
Open

      def post(options = {})
        tags = [options[:tags] || []].flatten
        title = options[:title].to_s
        permlink = options[:permlink] || title.downcase.gsub(/[^a-z0-9\-]+/, '-')
        parent_permlink = options[:parent_permlink] || tags[0]

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

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

    Perceived complexity for shutdown is too high. [16/7]
    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 by rubocop

    This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

    Example:

    def my_method                   # 1
      if cond                       # 1
        case var                    # 2 (0.8 + 4 * 0.2, rounded)
        when 1 then func_one
        when 2 then func_two
        when 3 then func_three
        when 4..10 then func_other
        end
      else                          # 1
        do_something until a && b   # 2
      end                           # ===
    end                             # 7 complexity points

    Perceived complexity for handle_error is too high. [16/7]
    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 by rubocop

    This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

    Example:

    def my_method                   # 1
      if cond                       # 1
        case var                    # 2 (0.8 + 4 * 0.2, rounded)
        when 1 then func_one
        when 2 then func_two
        when 3 then func_three
        when 4..10 then func_other
        end
      else                          # 1
        do_something until a && b   # 2
      end                           # ===
    end                             # 7 complexity points

    Perceived complexity for post is too high. [16/7]
    Open

          def post(options = {})
            tags = [options[:tags] || []].flatten
            title = options[:title].to_s
            permlink = options[:permlink] || title.downcase.gsub(/[^a-z0-9\-]+/, '-')
            parent_permlink = options[:parent_permlink] || tags[0]

    This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

    Example:

    def my_method                   # 1
      if cond                       # 1
        case var                    # 2 (0.8 + 4 * 0.2, rounded)
        when 1 then func_one
        when 2 then func_two
        when 3 then func_three
        when 4..10 then func_other
        end
      else                          # 1
        do_something until a && b   # 2
      end                           # ===
    end                             # 7 complexity points

    Method has too many lines. [19/10]
    Open

        def to_bytes
          bytes = [id(@type.to_sym)].pack('C')
          
          Operation::param_names(@type.to_sym).each do |p|
            next unless defined? p
    Severity: Minor
    Found in lib/radiator/operation.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Method has too many lines. [18/10]
    Open

        def get_blocks(block_number, &block)
          block_number = [*(block_number)].flatten
          
          if !!block
            block_number.each do |i|
    Severity: Minor
    Found in lib/radiator/api.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Cyclomatic complexity for handle_error is too high. [14/6]
    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 by rubocop

    This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

    An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

    Assignment Branch Condition size for to_bytes is too high. [23.02/15]
    Open

          def to_bytes
        #set sz 1,  op type 0, see
        #https://github.com/steemit/steem-js/blob/733332d09582e95c0ea868a6ac5b6ee8a1f115ee/src/auth/serializer/src/operations.js#L355
        varint(1) + varint(0) + varint(@value.size) + @value.map do |b|
          case b
    Severity: Minor
    Found in lib/radiator/type/beneficiaries.rb by rubocop

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Method has too many lines. [18/10]
    Open

        def payload
          params = {}
          
          Operation::param_names(@type.to_sym).each do |p|
            next unless defined? p
    Severity: Minor
    Found in lib/radiator/operation.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Cyclomatic complexity for finalize is too high. [13/6]
    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 by rubocop

    This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

    An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

    Perceived complexity for default_failover_urls is too high. [14/7]
    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 by rubocop

    This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

    Example:

    def my_method                   # 1
      if cond                       # 1
        case var                    # 2 (0.8 + 4 * 0.2, rounded)
        when 1 then func_one
        when 2 then func_two
        when 3 then func_three
        when 4..10 then func_other
        end
      else                          # 1
        do_something until a && b   # 2
      end                           # ===
    end                             # 7 complexity points

    Cyclomatic complexity for default_failover_urls is too high. [13/6]
    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 by rubocop

    This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

    An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

    Method has too many lines. [17/10]
    Open

        def shutdown
          flappy = false
          
          begin
            unless @api.nil?
    Severity: Minor
    Found in lib/radiator/stream.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Perceived complexity for method_missing is too high. [14/7]
    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 by rubocop

    This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

    Example:

    def my_method                   # 1
      if cond                       # 1
        case var                    # 2 (0.8 + 4 * 0.2, rounded)
        when 1 then func_one
        when 2 then func_two
        when 3 then func_three
        when 4..10 then func_other
        end
      else                          # 1
        do_something until a && b   # 2
      end                           # ===
    end                             # 7 complexity points

    Assignment Branch Condition size for to_bytes is too high. [22.76/15]
    Open

        def to_bytes
          bytes = [id(@type.to_sym)].pack('C')
          
          Operation::param_names(@type.to_sym).each do |p|
            next unless defined? p
    Severity: Minor
    Found in lib/radiator/operation.rb by rubocop

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Severity
    Category
    Status
    Source
    Language