voxable-labs/hg

View on GitHub

Showing 436 of 436 total issues

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.

= is not aligned with the preceding assignment.
Open

            request.route = route
Severity: Minor
Found in lib/hg/router.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"

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

        unless route = request.route
Severity: Minor
Found in lib/hg/router.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

Freeze mutable objects assigned to constants.
Open

    DEFAULT = 'default'
Severity: Minor
Found in lib/hg/internal_actions.rb by rubocop

This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

Example:

# bad
CONST = [1, 2, 3]

# good
CONST = [1, 2, 3].freeze

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

      # @param user_id [String, Integer] The ID representing the user on this platform
Severity: Minor
Found in lib/hg/workers/base.rb by rubocop

Use parentheses for method calls with arguments. (https://github.com/voxable-labs/voxable-style-guide#method-invocation-parens)
Open

        logger.error e.message
Severity: Minor
Found in lib/hg/workers/base.rb by rubocop

This cop checks presence of parentheses in method calls containing parameters. By default, macro methods are ignored. Additional methods can be added to the IgnoredMethods list.

Example:

# bad
array.delete e

# good
array.delete(e)

# good
# Operators don't need parens
foo == bar

# good
# Setter methods don't need parens
foo.bar = baz

# okay with `puts` listed in `IgnoredMethods`
puts 'test'

# IgnoreMacros: true (default)

# good
class Foo
  bar :baz
end

# IgnoreMacros: false

# bad
class Foo
  bar :baz
end

Use alias instead of alias_method in a class body. (https://github.com/voxable-labs/voxable-style-guide#alias-method)
Open

    alias_method :respond_with, :respond
Severity: Minor
Found in lib/hg/controller.rb by rubocop

This cop enforces the use of either #alias or #alias_method depending on configuration. It also flags uses of alias :symbol rather than alias bareword.

Example: EnforcedStyle: prefer_alias (default)

# bad
alias_method :bar, :foo
alias :bar :foo

# good
alias bar foo

Example: EnforcedStyle: preferaliasmethod

# bad
alias :bar :foo
alias bar foo

# good
alias_method :bar, :foo

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

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

Redundant return detected. To return multiple values, use an array. (https://github.com/voxable-labs/voxable-style-guide#no-explicit-return)
Open

        return nlu_response, params
Severity: Minor
Found in lib/hg/workers/base.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.

Add a line break before the first argument of a multi-line method argument list.
Open

        action(action_name,
Severity: Minor
Found in lib/hg/router.rb by rubocop

This cop checks for a line break before the first argument in a multi-line method call.

Example:

# bad
  method(foo, bar,
    baz)

  # good
  method(
    foo, bar,
    baz)

  # ignored
  method foo, bar,
    baz

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

Unused method argument - block. If it's necessary, use _ or _block as an argument name to indicate that it won't be used. (https://github.com/voxable-labs/voxable-style-guide#underscore-unused-vars)
Open

      def controller(controller_class, &block)
Severity: Minor
Found in lib/hg/router.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

Freeze mutable objects assigned to constants.
Open

      INTERNAL_ROUTES = {
        Hg::InternalActions::DISPLAY_CHUNK => {
          controller: Hg::Controllers::ChunksController,
          handler: :display_chunk
        }
Severity: Minor
Found in lib/hg/router.rb by rubocop

This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

Example:

# bad
CONST = [1, 2, 3]

# good
CONST = [1, 2, 3].freeze

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

      # @param handler_method_name [Symbol] The name of the handler method on the
Severity: Minor
Found in lib/hg/router.rb by rubocop

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

        # TODO: BUG Thread.current isn't going to work in case of multiple routers
Severity: Minor
Found in lib/hg/router.rb by rubocop

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

      # @param handler_method_name [Symbol] The name of the handler method on the
Severity: Minor
Found in lib/hg/router.rb by rubocop

Use parentheses for method calls with arguments. (https://github.com/voxable-labs/voxable-style-guide#method-invocation-parens)
Open

        action Hg::InternalActions::DEFAULT,
               controller: controller,
               with: handler_method_name
Severity: Minor
Found in lib/hg/router.rb by rubocop

This cop checks presence of parentheses in method calls containing parameters. By default, macro methods are ignored. Additional methods can be added to the IgnoredMethods list.

Example:

# bad
array.delete e

# good
array.delete(e)

# good
# Operators don't need parens
foo == bar

# good
# Setter methods don't need parens
foo.bar = baz

# okay with `puts` listed in `IgnoredMethods`
puts 'test'

# IgnoreMacros: true (default)

# good
class Foo
  bar :baz
end

# IgnoreMacros: false

# bad
class Foo
  bar :baz
end

Missing method documentation comment.
Open

    def flash(message)
      message = message.sample if message.respond_to?(:sample)
      respond(message)
      show_typing
    end
Severity: Minor
Found in lib/hg/controller.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 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
Severity
Category
Status
Source
Language