am-kantox/iteraptor

View on GitHub
lib/iteraptor.rb

Summary

Maintainability
D
1 day
Test Coverage

Assignment Branch Condition size for mapa_in_array is too high. [26.7/15]
Open

  def mapa_in_array root = nil, parent = nil, **params, &λ
    map.with_index do |e, idx|
      p = H.push_flatten_compact(parent, idx)
      p = p.join(H.iteraptor_delimiter(params)) unless params[:full_parent]

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

Assignment Branch Condition size for path_matcher is too high. [24.37/15]
Open

      def path_matcher path
        pm =
          path.map do |kind, value|
            case kind
            when :key, :elem, :at then ->(k, _) { value == k }
Severity: Minor
Found in lib/iteraptor.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

Assignment Branch Condition size for to_hash_or_array is too high. [23.43/15]
Open

  def to_hash_or_array **params
    # rubocop:disable Style/MultilineTernaryOperator
    # rubocop:disable Style/RescueModifier
    receiver =
      is_a?(Array) &&
Severity: Minor
Found in lib/iteraptor.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

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

  def mapa_in_array root = nil, parent = nil, **params, &λ
    map.with_index do |e, idx|
      p = H.push_flatten_compact(parent, idx)
      p = p.join(H.iteraptor_delimiter(params)) unless params[:full_parent]

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

Method compactar has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def compactar **params
    (is_a?(Array) ? compact : self).
      mapa(yield_all: true) do |_p, (k, v)|
        v.is_a?(Array) ? [k, v.compact] : [k, v]
      end.mapa(**params) do |parent, (k, v)|
Severity: Minor
Found in lib/iteraptor.rb - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Cyclomatic complexity for mapa_in_array is too high. [12/6]
Open

  def mapa_in_array root = nil, parent = nil, **params, &λ
    map.with_index do |e, idx|
      p = H.push_flatten_compact(parent, idx)
      p = p.join(H.iteraptor_delimiter(params)) unless params[:full_parent]

Severity: Minor
Found in lib/iteraptor.rb by rubocop

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.

Perceived complexity for mapa_in_array is too high. [12/7]
Open

  def mapa_in_array root = nil, parent = nil, **params, &λ
    map.with_index do |e, idx|
      p = H.push_flatten_compact(parent, idx)
      p = p.join(H.iteraptor_delimiter(params)) unless params[:full_parent]

Severity: Minor
Found in lib/iteraptor.rb by rubocop

This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

Example:

def my_method                   # 1
  if cond                       # 1
    case var                    # 2 (0.8 + 4 * 0.2, rounded)
    when 1 then func_one
    when 2 then func_two
    when 3 then func_three
    when 4..10 then func_other
    end
  else                          # 1
    do_something until a && b   # 2
  end                           # ===
end                             # 7 complexity points

Assignment Branch Condition size for rechazar_o_escoger is too high. [20.86/15]
Open

  def rechazar_o_escoger method, *filter, **params
    raise ArgumentError, "no filter given in call to #{method ? :escoger : :rechazar}" if filter.empty?

    plough = method ? :none? : :any?
    aplanar(**params).each_with_object({}) do |(key, value), acc|
Severity: Minor
Found in lib/iteraptor.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

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

      def path_matcher path
        pm =
          path.map do |kind, value|
            case kind
            when :key, :elem, :at then ->(k, _) { value == k }
Severity: Minor
Found in lib/iteraptor.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.

Method mapa_in_array has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  def mapa_in_array root = nil, parent = nil, **params, &λ
    map.with_index do |e, idx|
      p = H.push_flatten_compact(parent, idx)
      p = p.join(H.iteraptor_delimiter(params)) unless params[:full_parent]

Severity: Minor
Found in lib/iteraptor.rb - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method rechazar_o_escoger has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def rechazar_o_escoger method, *filter, **params
    raise ArgumentError, "no filter given in call to #{method ? :escoger : :rechazar}" if filter.empty?

    plough = method ? :none? : :any?
    aplanar(**params).each_with_object({}) do |(key, value), acc|
Severity: Minor
Found in lib/iteraptor.rb - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Cyclomatic complexity for to_hash_or_array is too high. [9/6]
Open

  def to_hash_or_array **params
    # rubocop:disable Style/MultilineTernaryOperator
    # rubocop:disable Style/RescueModifier
    receiver =
      is_a?(Array) &&
Severity: Minor
Found in lib/iteraptor.rb by rubocop

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.

Cyclomatic complexity for path_matcher is too high. [9/6]
Open

      def path_matcher path
        pm =
          path.map do |kind, value|
            case kind
            when :key, :elem, :at then ->(k, _) { value == k }
Severity: Minor
Found in lib/iteraptor.rb by rubocop

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.

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

  def rechazar_o_escoger method, *filter, **params
    raise ArgumentError, "no filter given in call to #{method ? :escoger : :rechazar}" if filter.empty?

    plough = method ? :none? : :any?
    aplanar(**params).each_with_object({}) do |(key, value), acc|
Severity: Minor
Found in lib/iteraptor.rb by rubocop

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

  def compactar **params
    (is_a?(Array) ? compact : self).
      mapa(yield_all: true) do |_p, (k, v)|
        v.is_a?(Array) ? [k, v.compact] : [k, v]
      end.mapa(**params) do |parent, (k, v)|
Severity: Minor
Found in lib/iteraptor.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

Perceived complexity for to_hash_or_array is too high. [9/7]
Open

  def to_hash_or_array **params
    # rubocop:disable Style/MultilineTernaryOperator
    # rubocop:disable Style/RescueModifier
    receiver =
      is_a?(Array) &&
Severity: Minor
Found in lib/iteraptor.rb by rubocop

This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

Example:

def my_method                   # 1
  if cond                       # 1
    case var                    # 2 (0.8 + 4 * 0.2, rounded)
    when 1 then func_one
    when 2 then func_two
    when 3 then func_three
    when 4..10 then func_other
    end
  else                          # 1
    do_something until a && b   # 2
  end                           # ===
end                             # 7 complexity points

Perceived complexity for rechazar_o_escoger is too high. [8/7]
Open

  def rechazar_o_escoger method, *filter, **params
    raise ArgumentError, "no filter given in call to #{method ? :escoger : :rechazar}" if filter.empty?

    plough = method ? :none? : :any?
    aplanar(**params).each_with_object({}) do |(key, value), acc|
Severity: Minor
Found in lib/iteraptor.rb by rubocop

This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

Example:

def my_method                   # 1
  if cond                       # 1
    case var                    # 2 (0.8 + 4 * 0.2, rounded)
    when 1 then func_one
    when 2 then func_two
    when 3 then func_three
    when 4..10 then func_other
    end
  else                          # 1
    do_something until a && b   # 2
  end                           # ===
end                             # 7 complexity points

Cyclomatic complexity for mapa_in_hash is too high. [7/6]
Open

  def mapa_in_hash root = nil, parent = nil, **params, &λ
    map do |k, v|
      p = H.push_flatten_compact(parent, k)
      p = p.join(H.iteraptor_delimiter(params)) unless params[:full_parent]

Severity: Minor
Found in lib/iteraptor.rb by rubocop

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.

Cyclomatic complexity for compactar is too high. [7/6]
Open

  def compactar **params
    (is_a?(Array) ? compact : self).
      mapa(yield_all: true) do |_p, (k, v)|
        v.is_a?(Array) ? [k, v.compact] : [k, v]
      end.mapa(**params) do |parent, (k, v)|
Severity: Minor
Found in lib/iteraptor.rb by rubocop

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

  def mapa_in_hash root = nil, parent = nil, **params, &λ
    map do |k, v|
      p = H.push_flatten_compact(parent, k)
      p = p.join(H.iteraptor_delimiter(params)) unless params[:full_parent]

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

Method mapa_in_hash has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def mapa_in_hash root = nil, parent = nil, **params, &λ
    map do |k, v|
      p = H.push_flatten_compact(parent, k)
      p = p.join(H.iteraptor_delimiter(params)) unless params[:full_parent]

Severity: Minor
Found in lib/iteraptor.rb - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method aplanar has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def aplanar **params
    return self if empty?
    cada(**params).with_object({}) do |(key, value), acc|
      key = key.join(H.iteraptor_delimiter(params)) if params[:full_parent]
      key = key.to_sym if params[:symbolize_keys]
Severity: Minor
Found in lib/iteraptor.rb - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method to_hash_or_array has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def to_hash_or_array **params
    # rubocop:disable Style/MultilineTernaryOperator
    # rubocop:disable Style/RescueModifier
    receiver =
      is_a?(Array) &&
Severity: Minor
Found in lib/iteraptor.rb - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method plana_mapa has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def plana_mapa **params
    return enum_for(:plana_mapa, delimiter: params[:delimiter], **params) unless block_given?
    return self if empty?

    cada(**params).with_object([]) do |(key, value), acc|
Severity: Minor
Found in lib/iteraptor.rb - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method get_in has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def get_in path
    hash =
      cada(full_parent: true, yield_all: true).with_object({}) do |(key, value), memo|
        next unless path.length == key.length
        next unless H.path_matcher(path).(key, value)
Severity: Minor
Found in lib/iteraptor.rb - About 45 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method cada_in_array_or_hash has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def cada_in_array_or_hash in_array, root = nil, parent = nil, **params, &λ
    (in_array ? each_with_index : each).each do |k, v|
      k, v = v, k if in_array
      result = H.push_flatten_compact(parent, k)
      result = result.join(H.iteraptor_delimiter(params)) unless params[:full_parent]
Severity: Minor
Found in lib/iteraptor.rb - About 45 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method cada_in_array_or_hash has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def cada_in_array_or_hash in_array, root = nil, parent = nil, **params, &λ
Severity: Minor
Found in lib/iteraptor.rb - About 35 mins to fix

    Method apretar has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.apretar(object)
        case object
        when Enumerable
          object.
            map { |*maybe_kv| apretar(maybe_kv.flatten(1).last) }.
    Severity: Minor
    Found in lib/iteraptor.rb - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method path_matcher has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def path_matcher path
            pm =
              path.map do |kind, value|
                case kind
                when :key, :elem, :at then ->(k, _) { value == k }
    Severity: Minor
    Found in lib/iteraptor.rb - About 25 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Use yield instead of λ.call.
    Open

          H.path_matcher(path).(key, value) ? [k, λ.(value)] : [k, value]
    Severity: Minor
    Found in lib/iteraptor.rb by rubocop

    This cop identifies the use of a &block parameter and block.call where yield would do just as well.

    Example:

    # bad
    def method(&block)
      block.call
    end
    def another(&func)
      func.call 1, 2, 3
    end
    
    # good
    def method
      yield
    end
    def another
      yield 1, 2, 3
    end

    FIXME found
    Open

      # FIXME what happens if I return nil from mapa in array?
    Severity: Minor
    Found in lib/iteraptor.rb by fixme

    Place the . on the next line, together with the method name.
    Open

          object.
    Severity: Minor
    Found in lib/iteraptor.rb by rubocop

    This cop checks the . position in multi-line method calls.

    Example: EnforcedStyle: leading (default)

    # bad
    something.
      mehod
    
    # good
    something
      .method

    Example: EnforcedStyle: trailing

    # bad
    something
      .method
    
    # good
    something.
      mehod

    end at 294, 8 is not aligned with path.map do |kind, value| at 282, 10.
    Open

            end
    Severity: Minor
    Found in lib/iteraptor.rb by rubocop

    This cop checks whether the end keywords are aligned properly for do end blocks.

    Three modes are supported through the EnforcedStyleAlignWith configuration parameter:

    start_of_block : the end shall be aligned with the start of the line where the do appeared.

    start_of_line : the end shall be aligned with the start of the line where the expression started.

    either (which is the default) : the end is allowed to be in either location. The autofixer will default to start_of_line.

    Example: EnforcedStyleAlignWith: either (default)

    # bad
    
    foo.bar
       .each do
         baz
           end
    
    # good
    
    variable = lambda do |i|
      i
    end

    Example: EnforcedStyleAlignWith: startofblock

    # bad
    
    foo.bar
       .each do
         baz
           end
    
    # good
    
    foo.bar
      .each do
         baz
       end

    Example: EnforcedStyleAlignWith: startofline

    # bad
    
    foo.bar
       .each do
         baz
           end
    
    # good
    
    foo.bar
      .each do
         baz
    end

    Prefer the use of lambda.call(...) over lambda.(...).
    Open

          H.path_matcher(path).(key, value) ? [k, λ.(value)] : [k, value]
    Severity: Minor
    Found in lib/iteraptor.rb by rubocop

    This cop checks for use of the lambda.(args) syntax.

    Example: EnforcedStyle: call (default)

    # bad lambda.(x, y)

    # good lambda.call(x, y)

    Example: EnforcedStyle: braces

    # bad lambda.call(x, y)

    # good lambda.(x, y)

    Space missing to the left of {.
    Open

          parent = keys[0..-2].reduce(acc){ |h, kk| h[kk] }
    Severity: Minor
    Found in lib/iteraptor.rb by rubocop

    Checks that block braces have or don't have a space before the opening brace depending on configuration.

    Example:

    # bad
    foo.map{ |a|
      a.bar.to_s
    }
    
    # good
    foo.map { |a|
      a.bar.to_s
    }

    Space missing to the left of {.
    Open

          next if filter.public_send(plough, &->(f){ to_match.any?(&f.method(:===)) })
    Severity: Minor
    Found in lib/iteraptor.rb by rubocop

    Checks that block braces have or don't have a space before the opening brace depending on configuration.

    Example:

    # bad
    foo.map{ |a|
      a.bar.to_s
    }
    
    # good
    foo.map { |a|
      a.bar.to_s
    }

    Useless assignment to variable - match_path.
    Open

        match_path = ->(key) { H.path_matcher(path, key, value) }
    Severity: Minor
    Found in lib/iteraptor.rb by rubocop

    This cop checks for every useless assignment to local variable in every scope. The basic idea for this cop was from the warning of ruby -cw:

    assigned but unused variable - foo

    Currently this cop has advanced logic that detects unreferenced reassignments and properly handles varied cases such as branch, loop, rescue, ensure, etc.

    Example:

    # bad
    
    def some_method
      some_var = 1
      do_something
    end

    Example:

    # good
    
    def some_method
      some_var = 1
      do_something(some_var)
    end

    Prefer the use of lambda.call(...) over lambda.(...).
    Open

                when :filter then ->(_, v) { value.to_proc.(v) }
    Severity: Minor
    Found in lib/iteraptor.rb by rubocop

    This cop checks for use of the lambda.(args) syntax.

    Example: EnforcedStyle: call (default)

    # bad lambda.(x, y)

    # good lambda.call(x, y)

    Example: EnforcedStyle: braces

    # bad lambda.call(x, y)

    # good lambda.(x, y)

    Prefer the use of lambda.call(...) over lambda.(...).
    Open

            ->(key, value) { path.length == key.length && pm.zip(key).all? { |m, k| m.(k, value) } }
    Severity: Minor
    Found in lib/iteraptor.rb by rubocop

    This cop checks for use of the lambda.(args) syntax.

    Example: EnforcedStyle: call (default)

    # bad lambda.(x, y)

    # good lambda.call(x, y)

    Example: EnforcedStyle: braces

    # bad lambda.call(x, y)

    # good lambda.(x, y)

    Re-enable Naming/VariableNumber cop with # rubocop:enable after disabling it.
    Open

    # rubocop:disable Style/VariableNumber
    Severity: Minor
    Found in lib/iteraptor.rb by rubocop

    Favor format over String#%.
    Open

        raise NoMethodError, HASH_TO_ARRAY_ERROR_MSG % [inspect, self.class] unless is_a?(Hash)
    Severity: Minor
    Found in lib/iteraptor.rb by rubocop

    This cop enforces the use of a single string formatting utility. Valid options include Kernel#format, Kernel#sprintf and String#%.

    The detection of String#% cannot be implemented in a reliable manner for all cases, so only two scenarios are considered - if the first argument is a string literal and if the second argument is an array literal.

    Example: EnforcedStyle: format(default)

    # bad
    puts sprintf('%10s', 'hoge')
    puts '%10s' % 'hoge'
    
    # good
    puts format('%10s', 'hoge')

    Example: EnforcedStyle: sprintf

    # bad
    puts format('%10s', 'hoge')
    puts '%10s' % 'hoge'
    
    # good
    puts sprintf('%10s', 'hoge')

    Example: EnforcedStyle: percent

    # bad
    puts format('%10s', 'hoge')
    puts sprintf('%10s', 'hoge')
    
    # good
    puts '%10s' % 'hoge'

    Use 2 (not 4) spaces for indentation.
    Open

                case kind
    Severity: Minor
    Found in lib/iteraptor.rb by rubocop

    This cops checks for indentation that doesn't use the specified number of spaces.

    See also the IndentationConsistency cop which is the companion to this one.

    Example:

    # bad
    class A
     def test
      puts 'hello'
     end
    end
    
    # good
    class A
      def test
        puts 'hello'
      end
    end

    Example: IgnoredPatterns: ['^\s*module']

    # bad
    module A
    class B
      def test
      puts 'hello'
      end
    end
    end
    
    # good
    module A
    class B
      def test
        puts 'hello'
      end
    end
    end

    Re-enable Metrics/ModuleLength cop with # rubocop:enable after disabling it.
    Open

    # rubocop:disable Metrics/ModuleLength
    Severity: Minor
    Found in lib/iteraptor.rb by rubocop

    Avoid multi-line chains of blocks.
    Open

          end.mapa(**params) do |parent, (k, v)|
    Severity: Minor
    Found in lib/iteraptor.rb by rubocop

    This cop checks for chaining of a block after another block that spans multiple lines.

    Example:

    Thread.list.find_all do |t|
      t.alive?
    end.map do |t|
      t.object_id
    end

    Prefer annotated tokens (like %<foo>s</foo>) over unannotated tokens (like %s).
    Open

      HASH_TO_ARRAY_ERROR_MSG = %(undefined method `hash_to_array?' for "%s":%s).freeze
    Severity: Minor
    Found in lib/iteraptor.rb by rubocop

    Use a consistent style for named format string tokens.

    Note: unannotated style cop only works for strings which are passed as arguments to those methods: sprintf, format, %. The reason is that unannotated format is very similar to encoded URLs or Date/Time formatting strings.

    Example: EnforcedStyle: annotated (default)

    # bad
    format('%{greeting}', greeting: 'Hello')
    format('%s', 'Hello')
    
    # good
    format('%<greeting>s', greeting: 'Hello')</greeting>

    Example: EnforcedStyle: template

    # bad
    format('%<greeting>s', greeting: 'Hello')
    format('%s', 'Hello')
    
    # good
    format('%{greeting}', greeting: 'Hello')</greeting>

    Example: EnforcedStyle: unannotated

    # bad
    format('%<greeting>s', greeting: 'Hello')
    format('%{greeting}', 'Hello')
    
    # good
    format('%s', 'Hello')</greeting>

    Prefer annotated tokens (like %<foo>s</foo>) over unannotated tokens (like %s).
    Open

      HASH_TO_ARRAY_ERROR_MSG = %(undefined method `hash_to_array?' for "%s":%s).freeze
    Severity: Minor
    Found in lib/iteraptor.rb by rubocop

    Use a consistent style for named format string tokens.

    Note: unannotated style cop only works for strings which are passed as arguments to those methods: sprintf, format, %. The reason is that unannotated format is very similar to encoded URLs or Date/Time formatting strings.

    Example: EnforcedStyle: annotated (default)

    # bad
    format('%{greeting}', greeting: 'Hello')
    format('%s', 'Hello')
    
    # good
    format('%<greeting>s', greeting: 'Hello')</greeting>

    Example: EnforcedStyle: template

    # bad
    format('%<greeting>s', greeting: 'Hello')
    format('%s', 'Hello')
    
    # good
    format('%{greeting}', greeting: 'Hello')</greeting>

    Example: EnforcedStyle: unannotated

    # bad
    format('%<greeting>s', greeting: 'Hello')
    format('%{greeting}', 'Hello')
    
    # good
    format('%s', 'Hello')</greeting>

    Avoid multi-line chains of blocks.
    Open

          end.tap do |this|
    Severity: Minor
    Found in lib/iteraptor.rb by rubocop

    This cop checks for chaining of a block after another block that spans multiple lines.

    Example:

    Thread.list.find_all do |t|
      t.alive?
    end.map do |t|
      t.object_id
    end

    Prefer the use of lambda.call(...) over lambda.(...).
    Open

          H.path_matcher(path).(key, value) ? [k, λ.(value)] : [k, value]
    Severity: Minor
    Found in lib/iteraptor.rb by rubocop

    This cop checks for use of the lambda.(args) syntax.

    Example: EnforcedStyle: call (default)

    # bad lambda.(x, y)

    # good lambda.call(x, y)

    Example: EnforcedStyle: braces

    # bad lambda.call(x, y)

    # good lambda.(x, y)

    Place the . on the next line, together with the method name.
    Open

        (is_a?(Array) ? compact : self).
    Severity: Minor
    Found in lib/iteraptor.rb by rubocop

    This cop checks the . position in multi-line method calls.

    Example: EnforcedStyle: leading (default)

    # bad
    something.
      mehod
    
    # good
    something
      .method

    Example: EnforcedStyle: trailing

    # bad
    something
      .method
    
    # good
    something.
      mehod

    Place the . on the next line, together with the method name.
    Open

            map { |*maybe_kv| apretar(maybe_kv.flatten(1).last) }.
    Severity: Minor
    Found in lib/iteraptor.rb by rubocop

    This cop checks the . position in multi-line method calls.

    Example: EnforcedStyle: leading (default)

    # bad
    something.
      mehod
    
    # good
    something
      .method

    Example: EnforcedStyle: trailing

    # bad
    something
      .method
    
    # good
    something.
      mehod

    Redundant self detected.
    Open

          self.tap { |this| this[key.first] = value }
    Severity: Minor
    Found in lib/iteraptor.rb by rubocop

    This cop checks for redundant uses of self.

    The usage of self is only needed when:

    • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

    • Calling an attribute writer to prevent an local variable assignment.

    Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

    Note we allow uses of self with operators because it would be awkward otherwise.

    Example:

    # bad
    def foo(bar)
      self.baz
    end
    
    # good
    def foo(bar)
      self.bar  # Resolves name clash with the argument.
    end
    
    def foo
      bar = 1
      self.bar  # Resolves name clash with the local variable.
    end
    
    def foo
      %w[x y z].select do |bar|
        self.bar == bar  # Resolves name clash with argument of the block.
      end
    end

    Prefer the use of lambda.call(...) over lambda.(...).
    Open

            next unless H.path_matcher(path).(key, value)
    Severity: Minor
    Found in lib/iteraptor.rb by rubocop

    This cop checks for use of the lambda.(args) syntax.

    Example: EnforcedStyle: call (default)

    # bad lambda.(x, y)

    # good lambda.call(x, y)

    Example: EnforcedStyle: braces

    # bad lambda.call(x, y)

    # good lambda.(x, y)

    Prefer the use of lambda.call(...) over lambda.(...).
    Open

                  when ->(p) { p.respond_to?(:to_proc) } then ->(k, _) { value.to_proc.(k) }
    Severity: Minor
    Found in lib/iteraptor.rb by rubocop

    This cop checks for use of the lambda.(args) syntax.

    Example: EnforcedStyle: call (default)

    # bad lambda.(x, y)

    # good lambda.call(x, y)

    Example: EnforcedStyle: braces

    # bad lambda.call(x, y)

    # good lambda.(x, y)

    There are no issues that match your filters.

    Category
    Status