rakuten-ws/rws-ruby-sdk

View on GitHub
lib/rakuten_web_service/configuration.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%

Use each_with_object instead of inject.
Open

      params.inject({}) do |h, (k, v)|

This cop looks for inject / reduce calls where the passed in object is returned at the end and so could be replaced by eachwithobject without the need to return the object at the end.

However, we can't replace with eachwithobject if the accumulator parameter is assigned to within the block.

Example:

# bad
[1, 2].inject({}) { |a, e| a[e] = e; a }

# good
[1, 2].each_with_object({}) { |e, a| a[e] = e }

Rename has_required_options? to required_options?.
Open

    def has_required_options?

This cop makes sure that predicates are named properly.

Example:

# bad
def is_even?(value)
end

# good
def even?(value)
end

# bad
def has_value?
end

# good
def value?
end

Line is too long. [89/80]
Open

      { application_id: application_id, affiliate_id: affiliate_id, format_version: '2' }

Missing top-level class documentation comment.
Open

  class Configuration

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

There are no issues that match your filters.

Category
Status