am-kantox/iteraptor

View on GitHub

Showing 62 of 62 total issues

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

Unnecessary utf-8 encoding comment.
Open

# coding: utf-8
Severity: Minor
Found in iteraptor.gemspec by rubocop

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

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
}

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

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

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

Unnecessary utf-8 encoding comment.
Open

# encoding: UTF-8
Severity: Minor
Found in Rakefile by rubocop

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

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

Add an empty line after magic comments.
Open

lib = File.expand_path('../lib', __FILE__)
Severity: Minor
Found in iteraptor.gemspec 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

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)

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

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>

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'

Add an empty line after magic comments.
Open

require 'rubygems'
Severity: Minor
Found in Rakefile 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

Use warn instead of $stderr.puts to allow such output to be disabled.
Open

  $stderr.puts 'Run `bundle install` to install missing gems'
Severity: Minor
Found in Rakefile by rubocop

This cop identifies places where $stderr.puts can be replaced by warn. The latter has the advantage of easily being disabled by, e.g. the -W0 interpreter flag, or setting $VERBOSE to nil.

Example:

# bad
$stderr.puts('hello')

# good
warn('hello')

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
}

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 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)

Severity
Category
Status
Source
Language