zeisler/active_mocker

View on GitHub
lib/active_mocker/mock/single_relation.rb

Summary

Maintainability
A
0 mins
Test Coverage

Use each_value instead of each. (https://github.com/bbatsov/ruby-style-guide#hash-each)
Open

      [*item.class._find_associations_by_class(child_self.class.send("mocked_class"))].each do |_type, relations|

This cop checks for uses of each_key and each_value Hash methods.

Note: If you have an array of two-element arrays, you can put parentheses around the block arguments to indicate that you're not working with a hash, and suppress RuboCop offenses.

Example:

# bad
hash.keys.each { |k| p k }
hash.values.each { |v| p v }
hash.each { |k, _v| p k }
hash.each { |_k, v| p v }

# good
hash.each_key { |k| p k }
hash.each_value { |v| p v }

Add an empty line after magic comments. (https://github.com/bbatsov/ruby-style-guide#separate-magic-comments-from-code)
Open

module ActiveMocker

Checks for a newline after the final magic comment.

Example:

# good
# frozen_string_literal: true

# Some documentation for Person
class Person
  # Some code
end

# bad
# frozen_string_literal: true
# Some documentation for Person
class Person
  # Some code
end

Unused method argument - foreign_key. (https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars)
Open

    def initialize(item, child_self:, foreign_key:)

This cop checks for unused method arguments.

Example:

# bad

def some_method(used, unused, _unused_but_allowed)
  puts used
end

Example:

# good

def some_method(used, _unused, _unused_but_allowed)
  puts used
end

There are no issues that match your filters.

Category
Status