voxable-labs/hg

View on GitHub
lib/hg/redis.rb

Summary

Maintainability
A
0 mins
Test Coverage

TODO found
Open

      # TODO: Should enable setting connection pool size/timeout/redis URL as config option on Hg
Severity: Minor
Found in lib/hg/redis.rb by fixme

TODO found
Open

    # TODO: test
Severity: Minor
Found in lib/hg/redis.rb by fixme

TODO found
Open

    # TODO: test
Severity: Minor
Found in lib/hg/redis.rb by fixme

Missing method documentation comment.
Open

    def pool
      # TODO: Should enable setting connection pool size/timeout/redis URL as config option on Hg
      @pool ||= ConnectionPool.new(size: ENV['REDIS_CONNECTION_POOL_SIZE'], timeout: 5) do
        ::Redis.new(url: ENV['REDIS_URL'] || 'redis://localhost:6379')
      end
Severity: Minor
Found in lib/hg/redis.rb by rubocop

This cop checks for missing documentation comment for public methods. It can optionally be configured to also require documentation for non-public methods.

Example:

# bad

class Foo
  def bar
    puts baz
  end
end

module Foo
  def bar
    puts baz
  end
end

def foo.bar
  puts baz
end

# good

class Foo
  # Documentation
  def bar
    puts baz
  end
end

module Foo
  # Documentation
  def bar
    puts baz
  end
end

# Documentation
def foo.bar
  puts baz
end

Missing method documentation comment.
Open

    def execute(&block)
      pool.with do |conn|
        yield(conn)
      end
    end
Severity: Minor
Found in lib/hg/redis.rb by rubocop

This cop checks for missing documentation comment for public methods. It can optionally be configured to also require documentation for non-public methods.

Example:

# bad

class Foo
  def bar
    puts baz
  end
end

module Foo
  def bar
    puts baz
  end
end

def foo.bar
  puts baz
end

# good

class Foo
  # Documentation
  def bar
    puts baz
  end
end

module Foo
  # Documentation
  def bar
    puts baz
  end
end

# Documentation
def foo.bar
  puts baz
end

Right hand side of multi-line assignment is on the same line as the assignment operator =. (https://github.com/voxable-labs/voxable-style-guide#indent-conditional-assignment)
Open

      @pool ||= ConnectionPool.new(size: ENV['REDIS_CONNECTION_POOL_SIZE'], timeout: 5) do
        ::Redis.new(url: ENV['REDIS_URL'] || 'redis://localhost:6379')
      end
Severity: Minor
Found in lib/hg/redis.rb by rubocop

This cop checks whether the multiline assignments have a newline after the assignment operator.

Example: EnforcedStyle: new_line (default)

# bad
foo = if expression
  'bar'
end

# good
foo =
  if expression
    'bar'
  end

# good
foo =
  begin
    compute
  rescue => e
    nil
  end

Example: EnforcedStyle: same_line

# good
foo = if expression
  'bar'
end

Line is too long. [90/80] (https://github.com/voxable-labs/voxable-style-guide#80-character-limits)
Open

      @pool ||= ConnectionPool.new(size: ENV['REDIS_CONNECTION_POOL_SIZE'], timeout: 5) do
Severity: Minor
Found in lib/hg/redis.rb by rubocop

Use nested module/class definitions instead of compact style. (https://github.com/voxable-labs/voxable-style-guide#namespace-definition)
Open

class Hg::Redis
Severity: Minor
Found in lib/hg/redis.rb by rubocop

This cop checks the style of children definitions at classes and modules. Basically there are two different styles:

Example: EnforcedStyle: nested (default)

# good
# have each child on its own line
class Foo
  class Bar
  end
end

Example: EnforcedStyle: compact

# good
# combine definitions as much as possible
class Foo::Bar
end

The compact style is only forced for classes/modules with one child.

Unused method argument - block. If it's necessary, use _ or _block as an argument name to indicate that it won't be used. You can also write as execute(*) if you want the method to accept any arguments but don't care about them. (https://github.com/voxable-labs/voxable-style-guide#underscore-unused-vars)
Open

    def execute(&block)
Severity: Minor
Found in lib/hg/redis.rb by rubocop

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

Line is too long. [97/80] (https://github.com/voxable-labs/voxable-style-guide#80-character-limits)
Open

      # TODO: Should enable setting connection pool size/timeout/redis URL as config option on Hg
Severity: Minor
Found in lib/hg/redis.rb by rubocop

There are no issues that match your filters.

Category
Status