voxable-labs/hg

View on GitHub
lib/hg/queues/queue.rb

Summary

Maintainability
A
0 mins
Test Coverage

TODO found
Open

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

= is not aligned with the preceding assignment.
Open

          if message_json = conn.lpop(@key)
Severity: Minor
Found in lib/hg/queues/queue.rb by rubocop

This cop checks for extra/unnecessary whitespace.

Example:

# good if AllowForAlignment is true
name      = "RuboCop"
# Some comment and an empty line

website  += "/bbatsov/rubocop" unless cond
puts        "rubocop"          if     debug

# bad for any configuration
set_app("RuboCop")
website  = "https://github.com/bbatsov/rubocop"

Inconsistent indentation detected. (https://github.com/voxable-labs/voxable-style-guide#spaces-indentation)
Open

        def message_key(user_id:, namespace:, key_portion:)
          "#{namespace}:users:#{user_id}:#{key_portion}"
        end
Severity: Minor
Found in lib/hg/queues/queue.rb by rubocop

This cops checks for inconsistent indentation.

Example:

class A
  def test
    puts 'hello'
     puts 'world'
  end
end

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

# * We're using multiple Sidekiq workers executing in parallel to process messages.
Severity: Minor
Found in lib/hg/queues/queue.rb by rubocop

Use == if you meant to do a comparison or wrap the expression in parentheses to indicate you meant to assign in a condition. (https://github.com/voxable-labs/voxable-style-guide#safe-assignment-in-condition)
Open

          if message_json = conn.lpop(@key)
Severity: Minor
Found in lib/hg/queues/queue.rb by rubocop

This cop checks for assignments in the conditions of if/while/until.

Example:

# bad

if some_var = true
  do_something
end

Example:

# good

if some_var == true
  do_something
end

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

# Since each platform may have several different types of messages that need their
Severity: Minor
Found in lib/hg/queues/queue.rb by rubocop

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

        # @param key_portion [String] The portion of the queue representing this message queue.
Severity: Minor
Found in lib/hg/queues/queue.rb by rubocop

Prefer {...} over do...end for functional blocks. (https://github.com/voxable-labs/voxable-style-guide#single-line-blocks)
Open

        message = Hg::Redis.execute do |conn|
Severity: Minor
Found in lib/hg/queues/queue.rb by rubocop

Check for uses of braces or do/end around single line or multi-line blocks.

Example: EnforcedStyle: linecountbased (default)

# bad - single line block
items.each do |item| item / 5 end

# good - single line block
items.each { |item| item / 5 }

# bad - multi-line block
things.map { |thing|
  something = thing.some_method
  process(something)
}

# good - multi-line block
things.map do |thing|
  something = thing.some_method
  process(something)
end

Example: EnforcedStyle: semantic

# Prefer `do...end` over `{...}` for procedural blocks.

# return value is used/assigned
# bad
foo = map do |x|
  x
end
puts (map do |x|
  x
end)

# return value is not used out of scope
# good
map do |x|
  x
end

# Prefer `{...}` over `do...end` for functional blocks.

# return value is not used out of scope
# bad
each { |x|
  x
}

# return value is used/assigned
# good
foo = map { |x|
  x
}
map { |x|
  x
}.inspect

Example: EnforcedStyle: bracesforchaining

# bad
words.each do |word|
  word.flip.flop
end.join("-")

# good
words.each { |word|
  word.flip.flop
}.join("-")

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

# ...be it resolved that we need a distributed FIFO queue for processing messages.
Severity: Minor
Found in lib/hg/queues/queue.rb by rubocop

Redundant return detected. (https://github.com/voxable-labs/voxable-style-guide#no-explicit-return)
Open

        return message
Severity: Minor
Found in lib/hg/queues/queue.rb by rubocop

This cop checks for redundant return expressions.

Example:

def test
  return something
end

def test
  one
  two
  three
  return something
end

It should be extended to handle methods whose body is if/else or a case expression with a default branch.

Missing top-level class documentation comment.
Open

    class Queue
Severity: Minor
Found in lib/hg/queues/queue.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

= is not aligned with the following assignment.
Open

        message = Hg::Redis.execute do |conn|
Severity: Minor
Found in lib/hg/queues/queue.rb by rubocop

This cop checks for extra/unnecessary whitespace.

Example:

# good if AllowForAlignment is true
name      = "RuboCop"
# Some comment and an empty line

website  += "/bbatsov/rubocop" unless cond
puts        "rubocop"          if     debug

# bad for any configuration
set_app("RuboCop")
website  = "https://github.com/bbatsov/rubocop"

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

        message = Hg::Redis.execute do |conn|
          if message_json = conn.lpop(@key)
            JSON.parse(message_json)
          else
            {}
Severity: Minor
Found in lib/hg/queues/queue.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. [89/80] (https://github.com/voxable-labs/voxable-style-guide#80-character-limits)
Open

        # @param namespace [String] The redis namespace under which to store the message.
Severity: Minor
Found in lib/hg/queues/queue.rb by rubocop

There are no issues that match your filters.

Category
Status