reevoo/sapience-rb

View on GitHub
lib/sapience/core_ext/hash.rb

Summary

Maintainability
A
0 mins
Test Coverage

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

  def _deep_transform_keyz_in_object!(object, &block)
    case object
    when Hash
      object.keys.each do |key|
        value = object.delete(key)
Severity: Minor
Found in lib/sapience/core_ext/hash.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.

Use each_key instead of keys.each.
Open

      object.keys.each do |key|
Severity: Minor
Found in lib/sapience/core_ext/hash.rb by rubocop

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 }

Missing top-level class documentation comment.
Open

class Hash
Severity: Minor
Found in lib/sapience/core_ext/hash.rb by rubocop

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

Add an empty line after magic comments.
Open

class Hash
Severity: Minor
Found in lib/sapience/core_ext/hash.rb by rubocop

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

Line is too long. [89/80]
Open

    deep_transform_keyz! { |key| key.to_sym rescue key } # rubocop:disable RescueModifier
Severity: Minor
Found in lib/sapience/core_ext/hash.rb by rubocop

There are no issues that match your filters.

Category
Status