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

              Rails.logger.error e.inspect
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

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

          ::Facebook::Messenger::Bot.on :referral do |referral|
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

= is not aligned with the following assignment.
Open

        chunk_class = args[0]
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

        chunk_context = args[1] || {}
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"

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

            @postback = Facebook::Messenger::Incoming::Postback.new(raw_postback)
Severity: Minor
Found in app/workers/hg/postback_worker.rb by rubocop

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

            build_referral_request @referral, user
Severity: Minor
Found in app/workers/hg/postback_worker.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 following assignment.
Open

    message = message.to_json if message.is_a?(Hash)
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"

Space missing to the left of {.
Open

    catch_errors{
Severity: Minor
Found in lib/chatbase_api_client.rb by rubocop

Checks that block braces have or don't have a space before the opening brace depending on configuration.

Example:

# bad
foo.map{ |a|
  a.bar.to_s
}

# good
foo.map { |a|
  a.bar.to_s
}

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

Missing method documentation comment.
Open

        def initialize(user_id: nil, namespace: nil)
          key = message_key(
            user_id: user_id,
            namespace: namespace,
            key_portion: POSTBACKS_QUEUE_KEY_PORTION

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

Space missing to the left of {.
Open

      params.reject{ |p| p.blank? }
Severity: Minor
Found in lib/hg/api_ai_client.rb by rubocop

Checks that block braces have or don't have a space before the opening brace depending on configuration.

Example:

# bad
foo.map{ |a|
  a.bar.to_s
}

# good
foo.map { |a|
  a.bar.to_s
}

Prefer single-quoted strings when you don't need string interpolation or special symbols. (https://github.com/voxable-labs/voxable-style-guide#consistent-string-literals)
Open

  VERSION = "0.1.0"
Severity: Minor
Found in lib/hg/version.rb by rubocop

Checks if uses of quotes match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
"No special symbols"
"No string interpolation"
"Just text"

# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"

Example: EnforcedStyle: double_quotes

# bad
'Just some text'
'No special chars or interpolation'

# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"

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

          Facebook::Messenger::Bot.deliver({
             recipient: {id: recipient_psid},
             sender_action: 'typing_on'
           }, access_token: access_token)
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

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 }}

Put a space before an end-of-line comment.
Open

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

This cop checks for missing space between a token and a comment on the same line.

Example:

# bad
1 + 1# this operation does ...

# good
1 + 1 # this operation does ...

if condition requires an else-clause.
Open

          if ENV['CHATBASE_API_KEY']
            if !nlu_response[:intent] || request.intent == 'Default'
              @client.not_handled = true
            else
              @client.set_chatbase_fields(request.intent, message.text, false)
Severity: Minor
Found in app/workers/hg/message_worker.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

Trailing whitespace detected. (https://github.com/voxable-labs/voxable-style-guide#no-trailing-whitespace)
Open

          
Severity: Minor
Found in app/workers/hg/message_worker.rb by rubocop

Redundant curly braces around a hash parameter.
Open

            call_to_action_content[:payload] = JSON.generate({
              action: Hg::InternalActions::DISPLAY_CHUNK,
              parameters: {
                chunk: options[:to].to_s
              }
Severity: Minor
Found in lib/hg/messenger/bot.rb by rubocop

This cop checks for braces around the last parameter in a method call if the last parameter is a hash. It supports braces, no_braces and context_dependent styles.

Example: EnforcedStyle: braces

# The `braces` style enforces braces around all method
# parameters that are hashes.

# bad
some_method(x, y, a: 1, b: 2)

# good
some_method(x, y, {a: 1, b: 2})

Example: EnforcedStyle: no_braces (default)

# The `no_braces` style checks that the last parameter doesn't
# have braces around it.

# bad
some_method(x, y, {a: 1, b: 2})

# good
some_method(x, y, a: 1, b: 2)

Example: EnforcedStyle: context_dependent

# The `context_dependent` style checks that the last parameter
# doesn't have braces around it, but requires braces if the
# second to last parameter is also a hash literal.

# bad
some_method(x, y, {a: 1, b: 2})
some_method(x, y, {a: 1, b: 2}, a: 1, b: 2)

# good
some_method(x, y, a: 1, b: 2)
some_method(x, y, {a: 1, b: 2}, {a: 1, b: 2})

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

        # TODO: pass in a `user_id_field` to indicate how to find user in order to
Severity: Minor
Found in app/workers/hg/postback_worker.rb by rubocop

Avoid more than 3 levels of block nesting. (https://github.com/voxable-labs/voxable-style-guide#three-is-the-number-thou-shalt-count)
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

This cop checks for excessive nesting of conditional and looping constructs.

You can configure if blocks are considered using the CountBlocks option. When set to false (the default) blocks are not counted towards the nesting level. Set to true to count blocks as well.

The maximum level of nesting allowed is configurable.

Severity
Category
Status
Source
Language