voxable-labs/hg

View on GitHub

Showing 436 of 436 total issues

= is not aligned with the preceding assignment.
Open

      @handler_name = handler_name.to_s
Severity: Minor
Found in lib/hg/controller.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"

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.intent,
              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

Use 2 spaces for indentation in a hash, relative to the first position after the preceding left parenthesis.
Open

        recipient: {id: user.facebook_psid},
Severity: Minor
Found in lib/hg/controller.rb by rubocop

This cops checks the indentation of the first key in a hash literal where the opening brace and the first key are on separate lines. The other keys' indentations are handled by the AlignHash cop.

By default, Hash literals that are arguments in a method call with parentheses, and where the opening curly brace of the hash is on the same line as the opening parenthesis of the method call, shall have their first key indented one step (two spaces) more than the position inside the opening parenthesis.

Other hash literals shall have their first key indented one step more than the start of the line where the opening curly brace is.

This default style is called 'specialinsideparentheses'. Alternative styles are 'consistent' and 'align_braces'. Here are examples:

Example: EnforcedStyle: specialinsideparentheses (default)

# The `special_inside_parentheses` style enforces that the first key
# in a hash literal where the opening brace and the first key are on
# separate lines is indented one step (two spaces) more than the
# position inside the opening parentheses.

# bad
hash = {
  key: :value
}
and_in_a_method_call({
  no: :difference
                     })

# good
special_inside_parentheses
hash = {
  key: :value
}
but_in_a_method_call({
                       its_like: :this
                     })

Example: EnforcedStyle: consistent

# The `consistent` style enforces that the first key in a hash
# literal where the opening brace and the first key are on
# seprate lines is indented the same as a hash literal which is not
# defined inside a method call.

# bad
hash = {
  key: :value
}
but_in_a_method_call({
                       its_like: :this
                      })

# good
hash = {
  key: :value
}
and_in_a_method_call({
  no: :difference
})

Example: EnforcedStyle: align_braces

# The `align_brackets` style enforces that the opening and closing
# braces are indented to the same position.

# bad
and_now_for_something = {
                          completely: :different
}

# good
and_now_for_something = {
                          completely: :different
                        }

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

# Enables temporary storage of an ordered list of unprocessed messages for a user.

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

task :default => :spec
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

if condition requires an else-clause.
Open

        if api_ai_response[:status][:code] != 200
          # ...log an error.
          Sidekiq::Logging.logger.error "Error with API.ai request: #{api_ai_response.inspect}"

          # Return the default action.
Severity: Minor
Found in lib/hg/api_ai_client.rb by rubocop

Checks for if expressions that do not have an else branch. SupportedStyles

if

Example:

# bad
if condition
  statement
end

case

Example:

# bad
case var
when condition
  statement
end

Example:

# good
if condition
  statement
else
# the content of the else branch will be determined by Style/EmptyElse
end

= is not aligned with the preceding assignment.
Open

    parsed_response = JSON.parse(response)
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"

= is not aligned with the preceding assignment.
Open

            call_to_action_content[:payload] = JSON.generate({
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. [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

Space inside } missing. (https://github.com/voxable-labs/voxable-style-guide#spaces-operators)
Open

             recipient: {id: recipient_psid},
Severity: Minor
Found in lib/hg/messenger/bot.rb by rubocop

Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

Example: EnforcedStyle: space

# The `space` style enforces that hash literals have
# surrounding space.

# bad
h = {a: 1, b: 2}

# good
h = { a: 1, b: 2 }

Example: EnforcedStyle: no_space

# The `no_space` style enforces that hash literals have
# no surrounding space.

# bad
h = { a: 1, b: 2 }

# good
h = {a: 1, b: 2}

Example: EnforcedStyle: compact

# The `compact` style normally requires a space inside
# hash braces, with the exception that successive left
# braces or right braces are collapsed together in nested hashes.

# bad
h = { a: { b: 2 } }

# good
h = { a: { b: 2 }}

Freeze mutable objects assigned to constants.
Open

        MESSAGES_QUEUE_KEY_PORTION = 'messenger:messages'

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. [92/80] (https://github.com/voxable-labs/voxable-style-guide#80-character-limits)
Open

          Facebook::Messenger::Subscriptions.subscribe(access_token: ENV['FB_ACCESS_TOKEN'])
Severity: Minor
Found in lib/hg/messenger/bot.rb by rubocop

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

        # TODO: Shouldn't be constantizing user input. Need a way to sanitize this.

Missing method documentation comment.
Open

        def access_token
          @access_token || ENV['FB_ACCESS_TOKEN']
        end
Severity: Minor
Found in lib/hg/messenger/bot.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

Prefer keyword arguments to options hashes.
Open

        def nested_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

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

        # Although - payloads shouldn't be something the client is allowed to set, in Messenger.

= is not aligned with the preceding assignment.
Open

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

= is not aligned with the preceding assignment.
Open

            call_to_action_content[:url] = options[:url]
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. [81/80] (https://github.com/voxable-labs/voxable-style-guide#80-character-limits)
Open

  # `handler` in place of `action` in the method name. If the filter chain should
Severity: Minor
Found in lib/hg/controller.rb by rubocop

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

        base.extend ClassMethods
Severity: Minor
Found in lib/hg/messenger/bot.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
Severity
Category
Status
Source
Language