Showing 436 of 436 total issues
Missing method documentation comment. Open
def image_url_base(base)
@image_url_base_portion = base
end
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Use parentheses for method calls with arguments. (https://github.com/voxable-labs/voxable-style-guide#method-invocation-parens) Open
Facebook::Messenger::Profile.set @get_started_content, access_token: access_token
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Rails.logger.error e.backtrace
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Closing method call brace must be on the line after the last argument when opening brace is on a separate line from the first argument. Open
false)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks that the closing brace in a method call is either on the same line as the last method argument, or a new line.
When using the symmetrical
(default) style:
If a method call's opening brace is on the same line as the first argument of the call, then the closing brace should be on the same line as the last argument of the call.
If an method call's opening brace is on the line above the first argument of the call, then the closing brace should be on the line below the last argument of the call.
When using the new_line
style:
The closing brace of a multi-line method call must be on the line after the last argument of the call.
When using the same_line
style:
The closing brace of a multi-line method call must be on the same line as the last argument of the call.
Example:
# symmetrical: bad
# new_line: good
# same_line: bad
foo(a,
b
)
# symmetrical: bad
# new_line: bad
# same_line: good
foo(
a,
b)
# symmetrical: good
# new_line: bad
# same_line: good
foo(a,
b)
# symmetrical: good
# new_line: good
# same_line: bad
foo(
a,
b
)
Avoid more than 3 levels of block nesting. (https://github.com/voxable-labs/voxable-style-guide#three-is-the-number-thou-shalt-count) Open
if !nlu_response[:intent] || request.intent == 'Default'
@client.not_handled = true
else
@client.set_chatbase_fields(request.intent, message.text, false)
end
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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.
Use parentheses for method calls with arguments. (https://github.com/voxable-labs/voxable-style-guide#method-invocation-parens) Open
load 'rails/tasks/engine.rake'
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 top-level module documentation comment. Open
module Hg
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Useless assignment to variable - message_body
. (https://github.com/voxable-labs/voxable-style-guide#underscore-unused-vars) Open
message_body = {
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for every useless assignment to local variable in every
scope.
The basic idea for this cop was from the warning of ruby -cw
:
assigned but unused variable - foo
Currently this cop has advanced logic that detects unreferenced reassignments and properly handles varied cases such as branch, loop, rescue, ensure, etc.
Example:
# bad
def some_method
some_var = 1
do_something
end
Example:
# good
def some_method
some_var = 1
do_something(some_var)
end
Use parentheses for method calls with arguments. (https://github.com/voxable-labs/voxable-style-guide#method-invocation-parens) Open
logger.error e
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Freeze mutable objects assigned to constants. Open
BASE_PATH = 'https://chatbase.com/api/facebook'
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Redundant begin
block detected. (https://github.com/voxable-labs/voxable-style-guide#begin-implicit) Open
begin
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for redundant begin
blocks.
Currently it checks for code like this:
Example:
def redundant
begin
ala
bala
rescue StandardError => e
something
end
end
def preferred
ala
bala
rescue StandardError => e
something
end
=
is not aligned with the following assignment. Open
message = Hg::Redis.execute do |conn|
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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"
Missing top-level class documentation comment. Open
class PostbackQueue < Hg::Queues::Queue
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Missing method documentation comment. Open
def initialize(session_id)
# TODO: access token should be set by Hg config option
@client = ApiAiRuby::Client.new(
client_access_token: ENV['API_AI_CLIENT_ACCESS_TOKEN'],
api_version: '20170210',
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Use parentheses for method calls with arguments. (https://github.com/voxable-labs/voxable-style-guide#method-invocation-parens) Open
Sidekiq::Logging.logger.error e.backtrace.join("\n")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Indent the right brace the same as the first position after the preceding left parenthesis. Open
}, access_token: access_token)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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. [92/80] (https://github.com/voxable-labs/voxable-style-guide#80-character-limits) Open
# Since the class itself represents the bot, it must be immutable for thread-safety.
- Create a ticketCreate a ticket
- Exclude checks
Missing method documentation comment. Open
def init
subscribe_to_messages
initialize_message_handlers
initialize_get_started_button
initialize_persistent_menu
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 inside } missing. (https://github.com/voxable-labs/voxable-style-guide#spaces-operators) Open
recipient: {id: user.facebook_psid},
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 }}
Trailing whitespace detected. (https://github.com/voxable-labs/voxable-style-guide#no-trailing-whitespace) Open
- Create a ticketCreate a ticket
- Exclude checks