Showing 436 of 436 total issues
Provide an exception class and message as arguments to raise
. (https://github.com/voxable-labs/voxable-style-guide#exception-class-messages) Open
raise QueryError.new
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks the args passed to fail
and raise
. For exploded
style (default), it recommends passing the exception class and message
to raise
, rather than construct an instance of the error. It will
still allow passing just a message, or the construction of an error
with more than one argument.
The exploded style works identically, but with the addition that it will also suggest constructing error objects when the exception is passed multiple arguments.
Example: EnforcedStyle: exploded (default)
# bad
raise StandardError.new("message")
# good
raise StandardError, "message"
fail "message"
raise MyCustomError.new(arg1, arg2, arg3)
raise MyKwArgError.new(key1: val1, key2: val2)
Example: EnforcedStyle: compact
# bad
raise StandardError, "message"
raise RuntimeError, arg1, arg2, arg3
# good
raise StandardError.new("message")
raise MyCustomError.new(arg1, arg2, arg3)
fail "message"
unexpected token tCOLON
(Using Ruby 2.1 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
'id': recipient
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [101/80] (https://github.com/voxable-labs/voxable-style-guide#80-character-limits) Open
super('No Router class exists for this bot. Define a nested class Router, or set with router=')
- Create a ticketCreate a ticket
- Exclude checks
Missing method documentation comment. Open
def initialize_persistent_menu
Facebook::Messenger::Profile.set({
persistent_menu: [
locale: 'default',
composer_input_disabled: @input_disabled,
- 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
Rails.logger.info "Referral from sender: #{referral.sender['id']}"
- 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
Provide an exception class and message as arguments to raise
. (https://github.com/voxable-labs/voxable-style-guide#exception-class-messages) Open
raise NoRouterClassExistsError.new
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks the args passed to fail
and raise
. For exploded
style (default), it recommends passing the exception class and message
to raise
, rather than construct an instance of the error. It will
still allow passing just a message, or the construction of an error
with more than one argument.
The exploded style works identically, but with the addition that it will also suggest constructing error objects when the exception is passed multiple arguments.
Example: EnforcedStyle: exploded (default)
# bad
raise StandardError.new("message")
# good
raise StandardError, "message"
fail "message"
raise MyCustomError.new(arg1, arg2, arg3)
raise MyKwArgError.new(key1: val1, key2: val2)
Example: EnforcedStyle: compact
# bad
raise StandardError, "message"
raise RuntimeError, arg1, arg2, arg3
# good
raise StandardError.new("message")
raise MyCustomError.new(arg1, arg2, arg3)
fail "message"
=
is not aligned with the preceding assignment. Open
@performed = false
- 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"
Line is too long. [85/80] (https://github.com/voxable-labs/voxable-style-guide#80-character-limits) Open
# Generate a context based on merging the params into the user's current context.
- Create a ticketCreate a ticket
- Exclude checks
Redundant else
-clause. Open
else
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Checks for empty else-clauses, possibly including comments and/or an
explicit nil
depending on the EnforcedStyle.
Example: EnforcedStyle: empty
# warn only on empty else
# bad
if condition
statement
else
end
# good
if condition
statement
else
nil
end
# good
if condition
statement
else
statement
end
# good
if condition
statement
end
Example: EnforcedStyle: nil
# warn on else with nil in it
# bad
if condition
statement
else
nil
end
# good
if condition
statement
else
end
# good
if condition
statement
else
statement
end
# good
if condition
statement
end
Example: EnforcedStyle: both (default)
# warn on empty else and else with nil in it
# bad
if condition
statement
else
nil
end
# bad
if condition
statement
else
end
# good
if condition
statement
else
statement
end
# good
if condition
statement
end
=
is not aligned with the preceding assignment. Open
@text = text
- 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"
=
is not aligned with the preceding assignment. Open
if message_json = conn.lpop(@key)
- 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"
Line is too long. [83/80] (https://github.com/voxable-labs/voxable-style-guide#80-character-limits) Open
# * We're using multiple Sidekiq workers executing in parallel to process messages.
- Create a ticketCreate a ticket
- Exclude checks
Prefer keyword arguments to options hashes. Open
def initialize(options = {})
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
=
is not aligned with the preceding assignment. Open
base.nested_call_to_actions = []
- 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"
=
is not aligned with the preceding assignment. Open
raw_postback['postback'] = payload
- 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"
Use 2 spaces for indentation in a hash, relative to the start of the line where the left curly brace is. Open
title: title,
- 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
}
Use 2 spaces for indentation in a hash, relative to the first position after the preceding left parenthesis. Open
greeting: [
{
locale: 'default',
text: @greeting_text
}
- 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
}
Surrounding space missing for operator =
. (https://github.com/voxable-labs/voxable-style-guide#spaces-operators) Open
base.nested_menu_items =[]
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Checks that operators have space around them, except for ** which should not have surrounding space.
Example:
# bad
total = 3*4
"apple"+"juice"
my_number = 38/4
a ** b
# good
total = 3 * 4
"apple" + "juice"
my_number = 38 / 4
a**b
Missing method documentation comment. Open
def self.included(base)
base.extend ClassMethods
base.chunks = []
base.call_to_actions = []
base.nested_call_to_actions = []
- 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
Missing method documentation comment. Open
def call_to_action(text, options = {})
call_to_action_content = {
title: text
}
- 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