rakuten-ws/rws-ruby-sdk

View on GitHub

Showing 5 of 133 total issues

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

    def order(options)
      new_params = params.dup
      if options.to_s == 'standard'
        new_params[:sort] = 'standard'
        return self.class.new(new_params, @resource_class)

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.

Assignment Branch Condition size for order is too high. [18.81/15]
Open

    def order(options)
      new_params = params.dup
      if options.to_s == 'standard'
        new_params[:sort] = 'standard'
        return self.class.new(new_params, @resource_class)

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

Assignment Branch Condition size for parse_children_attributes is too high. [18.79/15]
Open

        def parse_children_attributes
          return @children = [] if children.nil? || children.empty?

          children_class = children.keys.first[/\A(\w*)Classes\Z/, 1]
          class_name = "#{children_class}Classes"

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

Cyclomatic complexity for find_resource_by_genre_id is too high. [8/6]
Open

      def self.find_resource_by_genre_id(genre_id)
        case genre_id
        when /^001/ then RWS::Books::Book
        when /^002/ then RWS::Books::CD
        when /^003/ then RWS::Books::DVD

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 initialize is too high. [15.94/15]
Open

      def initialize(hash)
        @table = {}
        hash.each do |(key, val)|
          val = self.class.new(val) if val.is_a?(Hash)
          val = val.map { |v| self.class.new(v) } if val.is_a?(Array)

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