rakuten-ws/rws-ruby-sdk

View on GitHub

Showing 145 of 145 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 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

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

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

Assignment Branch Condition size for get is too high. [15.33/15]
Open

    def get(params)
      params = RakutenWebService.configuration.generate_parameters(params)
      response = request(url.path, params)
      body = JSON.parse(response.body)

Severity: Minor
Found in lib/rakuten_web_service/client.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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

module RakutenWebService
  module Books
    class Magazine < Books::Resource
      endpoint 'https://app.rakuten.co.jp/services/api/BooksMagazine/Search/20170404'

Severity: Minor
Found in lib/rakuten_web_service/books/magazine.rb and 1 other location - About 35 mins to fix
lib/rakuten_web_service/books/cd.rb on lines 5..23

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 36.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

module RakutenWebService
  module Books
    class CD < Books::Resource
      endpoint 'https://app.rakuten.co.jp/services/api/BooksCD/Search/20170404'

Severity: Minor
Found in lib/rakuten_web_service/books/cd.rb and 1 other location - About 35 mins to fix
lib/rakuten_web_service/books/magazine.rb on lines 5..24

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 36.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

module RakutenWebService
  module Books
    class Software < Books::Resource
      endpoint 'https://app.rakuten.co.jp/services/api/BooksSoftware/Search/20170404'

Severity: Major
Found in lib/rakuten_web_service/books/software.rb and 3 other locations - About 35 mins to fix
lib/rakuten_web_service/books/dvd.rb on lines 5..23
lib/rakuten_web_service/books/foreign_book.rb on lines 5..22
lib/rakuten_web_service/books/game.rb on lines 5..23

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

module RakutenWebService
  module Books
    class ForeignBook < Books::Resource
      endpoint 'https://app.rakuten.co.jp/services/api/BooksForeignBook/Search/20170404'

Severity: Major
Found in lib/rakuten_web_service/books/foreign_book.rb and 3 other locations - About 35 mins to fix
lib/rakuten_web_service/books/dvd.rb on lines 5..23
lib/rakuten_web_service/books/game.rb on lines 5..23
lib/rakuten_web_service/books/software.rb on lines 5..23

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

module RakutenWebService
  module Books
    class Game < Books::Resource
      endpoint 'https://app.rakuten.co.jp/services/api/BooksGame/Search/20170404'

Severity: Major
Found in lib/rakuten_web_service/books/game.rb and 3 other locations - About 35 mins to fix
lib/rakuten_web_service/books/dvd.rb on lines 5..23
lib/rakuten_web_service/books/foreign_book.rb on lines 5..22
lib/rakuten_web_service/books/software.rb on lines 5..23

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

module RakutenWebService
  module Books
    class DVD < Books::Resource
      endpoint 'https://app.rakuten.co.jp/services/api/BooksDVD/Search/20170404'

Severity: Major
Found in lib/rakuten_web_service/books/dvd.rb and 3 other locations - About 35 mins to fix
lib/rakuten_web_service/books/foreign_book.rb on lines 5..22
lib/rakuten_web_service/books/game.rb on lines 5..23
lib/rakuten_web_service/books/software.rb on lines 5..23

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Missing top-level class documentation comment.
Open

    class SearchResult < RakutenWebService::SearchResult

This cop checks for missing top-level documentation of classes and modules. Classes with no body are exempt from the check and so are namespace modules - modules that have nothing in their bodies except classes, other modules, or constant definitions.

The documentation requirement is annulled if the class or module has a "#:nodoc:" comment next to it. Likewise, "#:nodoc: all" does the same for all its children.

Example:

# bad
class Person
  # ...
end

# good
# Description/Explanation of Person class
class Person
  # ...
end

Line is too long. [109/80]
Open

        %w(hotelBasicInfo hotelRatingInfo hotelDetailInfo hotelFacilitiesInfo hotelPolicyInfo hotelOtherInfo)

Do not prefix writer method names with set_.
Open

      def set_resource_name(name)
Severity: Minor
Found in lib/rakuten_web_service/resource.rb by rubocop

This cop makes sure that accessor methods are named properly.

Example:

# bad
def set_attribute(value)
end

# good
def attribute=(value)
end

# bad
def get_attribute
end

# good
def attribute
end

Line is too long. [105/80]
Open

      attribute :golfCourseId, :golfCourseName, :golfCourseAbbr, :golfCourseNameKana, :golfCourseCaption,

Line is too long. [98/80]
Open

          attribute :playDate, :stockStatus, :stockCount, :reservePageUrlPC, :reservePageUrlMobile

Line is too long. [113/80]
Open

        attribute :month, :planName, :planDate, :service, :price, :basePrice, :salesTax, :courseUseTax, :otherTax

Align the parameters of a method call if they span more than one line.
Open

        :productCaption, :releaseDate,

Here we check if the parameters on a multi-line method call or definition are aligned.

Example: EnforcedStyle: withfirstparameter (default)

# good

foo :bar,
    :baz

# bad

foo :bar,
  :baz

Example: EnforcedStyle: withfixedindentation

# good

foo :bar,
  :baz

# bad

foo :bar,
    :baz

Missing top-level class documentation comment.
Open

    class OpenStruct

This cop checks for missing top-level documentation of classes and modules. Classes with no body are exempt from the check and so are namespace modules - modules that have nothing in their bodies except classes, other modules, or constant definitions.

The documentation requirement is annulled if the class or module has a "#:nodoc:" comment next to it. Likewise, "#:nodoc: all" does the same for all its children.

Example:

# bad
class Person
  # ...
end

# good
# Description/Explanation of Person class
class Person
  # ...
end
Severity
Category
Status
Source
Language