voxable-labs/hg

View on GitHub

Showing 436 of 436 total issues

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

load 'rails/tasks/statistics.rake'
Severity: Minor
Found in Rakefile 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

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

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

        # Use intent name as action name if no action name is defined for this intent.
Severity: Minor
Found in lib/hg/api_ai_client.rb by rubocop

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

          Sidekiq::Logging.logger.error "Error with API.ai request: #{api_ai_response.inspect}"
Severity: Minor
Found in lib/hg/api_ai_client.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

= is not aligned with the preceding assignment.
Open

        base.nested_menu_items =[]
Severity: Minor
Found in lib/hg/messenger/bot.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"

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

          Facebook::Messenger::Profile.set({
            persistent_menu: [
              locale: 'default',
              composer_input_disabled: @input_disabled,
              call_to_actions: @call_to_actions
Severity: Minor
Found in lib/hg/messenger/bot.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. [91/80] (https://github.com/voxable-labs/voxable-style-guide#80-character-limits)
Open

        # @param message [Facebook::Messenger::Incoming::Message] The message to be queued.
Severity: Minor
Found in lib/hg/messenger/bot.rb by rubocop

Prefer keyword arguments to options hashes.
Open

        def menu_item(text, options = {})
Severity: Minor
Found in lib/hg/messenger/bot.rb by rubocop

This cop checks for options hashes and discourages them if the current Ruby version supports keyword arguments.

Example:

# bad
def fry(options = {})
  temperature = options.fetch(:temperature, 300)
  # ...
end


# good
def fry(temperature: 300)
  # ...
end

Redundant self detected. (https://github.com/voxable-labs/voxable-style-guide#no-self-unless-required)
Open

          Hg::PostbackWorker.perform_async(user_id, redis_namespace, self.to_s)
Severity: Minor
Found in lib/hg/messenger/bot.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

Missing space after #. (https://github.com/voxable-labs/voxable-style-guide#hash-space)
Open

  spec.add_runtime_dependency 'api-ai-ruby'#, '~> 1.2.3'
Severity: Minor
Found in hg.gemspec by rubocop

This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

Example:

# bad
#Some comment

# good
# Some comment

Favor a normal if-statement over a modifier clause in a multiline statement. (https://github.com/voxable-labs/voxable-style-guide#no-multiline-if-modifiers)
Open

          @client.set_chatbase_fields(
            request.action,
            message.text,
            false
          ) if ENV['CHATBASE_API_KEY']
Severity: Minor
Found in app/workers/hg/message_worker.rb by rubocop

Checks for uses of if/unless modifiers with multiple-lines bodies.

Example:

# bad
{
  result: 'this should not happen'
} unless cond

# good
{ result: 'ok' } if cond

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

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

# Represents an inbound request to a bot. Contains all relevant request information:
Severity: Minor
Found in lib/hg/request.rb by rubocop

= is not aligned with the following assignment.
Open

            payload = raw_postback['referral']['ref']
Severity: Minor
Found in lib/hg/messenger/bot.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"

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

        # @param recipient_id [String] The Facebook PSID of the user that will see the indicator
Severity: Minor
Found in lib/hg/messenger/bot.rb by rubocop

Missing top-level module documentation comment.
Open

      module ClassMethods
Severity: Minor
Found in lib/hg/messenger/bot.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

Prefer keyword arguments to options hashes.
Open

        def call_to_action(text, options = {})
Severity: Minor
Found in lib/hg/messenger/bot.rb by rubocop

This cop checks for options hashes and discourages them if the current Ruby version supports keyword arguments.

Example:

# bad
def fry(options = {})
  temperature = options.fetch(:temperature, 300)
  # ...
end


# good
def fry(temperature: 300)
  # ...
end

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 quick_reply_payload = message.quick_reply
Severity: Minor
Found in app/workers/hg/message_worker.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. [84/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 app/workers/hg/postback_worker.rb by rubocop

= is not aligned with the preceding assignment.
Open

    @text = params.fetch(:text, nil)
Severity: Minor
Found in lib/chatbase_api_client.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"
Severity
Category
Status
Source
Language