lib/hg/redis.rb
TODO found Open
Open
# TODO: Should enable setting connection pool size/timeout/redis URL as config option on Hg
- Create a ticketCreate a ticket
- Exclude checks
Missing method documentation comment. Open
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
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Open
def execute(&block)
pool.with do |conn|
yield(conn)
end
end
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Open
@pool ||= ConnectionPool.new(size: ENV['REDIS_CONNECTION_POOL_SIZE'], timeout: 5) do
::Redis.new(url: ENV['REDIS_URL'] || 'redis://localhost:6379')
end
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Open
@pool ||= ConnectionPool.new(size: ENV['REDIS_CONNECTION_POOL_SIZE'], timeout: 5) do
- Create a ticketCreate a ticket
- Exclude checks
Use nested module/class definitions instead of compact style. (https://github.com/voxable-labs/voxable-style-guide#namespace-definition) Open
Open
class Hg::Redis
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Open
def execute(&block)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Open
# TODO: Should enable setting connection pool size/timeout/redis URL as config option on Hg
- Create a ticketCreate a ticket
- Exclude checks