Showing 436 of 436 total issues
Line is too long. [86/80] (https://github.com/voxable-labs/voxable-style-guide#80-character-limits) Open
chunk_class.new(recipient: user.facebook_psid, context: chunk_context).deliver
- Create a ticketCreate a ticket
- Exclude checks
=
is not aligned with the following assignment. Open
@intent = intent
- 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
message_body = {
- 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. [82/80] (https://github.com/voxable-labs/voxable-style-guide#80-character-limits) Open
# @param redis_namespace [String] The redis namespace under which the postback
- Create a ticketCreate a ticket
- Exclude checks
Prefer symbols instead of strings as hash keys. (https://github.com/voxable-labs/voxable-style-guide#symbols-as-keys) Open
headers: { 'Content-Type' => 'application/json' }
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for the use of strings as keys in hashes. The use of symbols is preferred instead.
Example:
# bad
{ 'one' => 1, 'two' => 2, 'three' => 3 }
# good
{ one: 1, two: 2, three: 3 }
Use the new Ruby 1.9 hash syntax. (https://github.com/voxable-labs/voxable-style-guide#hash-literals) Open
task :default => :spec
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks hash literal syntax.
It can enforce either the use of the class hash rocket syntax or the use of the newer Ruby 1.9 syntax (when applicable).
A separate offense is registered for each problematic pair.
The supported styles are:
- ruby19 - forces use of the 1.9 syntax (e.g.
{a: 1}
) when hashes have all symbols for keys - hash_rockets - forces use of hash rockets for all hashes
- nomixedkeys - simply checks for hashes with mixed syntaxes
- ruby19nomixed_keys - forces use of ruby 1.9 syntax and forbids mixed syntax hashes
Example: EnforcedStyle: ruby19 (default)
# bad
{:a => 2}
{b: 1, :c => 2}
# good
{a: 2, b: 1}
{:c => 2, 'd' => 2} # acceptable since 'd' isn't a symbol
{d: 1, 'e' => 2} # technically not forbidden
Example: EnforcedStyle: hash_rockets
# bad
{a: 1, b: 2}
{c: 1, 'd' => 5}
# good
{:a => 1, :b => 2}
Example: EnforcedStyle: nomixedkeys
# bad
{:a => 1, b: 2}
{c: 1, 'd' => 2}
# good
{:a => 1, :b => 2}
{c: 1, d: 2}
Example: EnforcedStyle: ruby19nomixed_keys
# bad
{:a => 1, :b => 2}
{c: 2, 'd' => 3} # should just use hash rockets
# good
{a: 1, b: 2}
{:c => 3, 'd' => 4}
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 message_json = conn.lpop(@key)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Space missing to the left of {. Open
catch_errors{
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
}
Unused method argument - block
. If it's necessary, use _
or _block
as an argument name to indicate that it won't be used. You can also write as persistent_menu(*)
if you want the method to accept any arguments but don't care about them. (https://github.com/voxable-labs/voxable-style-guide#underscore-unused-vars) Open
def persistent_menu(&block)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for unused method arguments.
Example:
# bad
def some_method(used, unused, _unused_but_allowed)
puts used
end
Example:
# good
def some_method(used, _unused, _unused_but_allowed)
puts used
end
Use nested module/class definitions instead of compact style. (https://github.com/voxable-labs/voxable-style-guide#namespace-definition) Open
class Hg::Request
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks the style of children definitions at classes and modules. Basically there are two different styles:
Example: EnforcedStyle: nested (default)
# good
# have each child on its own line
class Foo
class Bar
end
end
Example: EnforcedStyle: compact
# good
# combine definitions as much as possible
class Foo::Bar
end
The compact style is only forced for classes/modules with one child.
=
is not aligned with the preceding assignment. Open
@router = router
- 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 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 query request'
- 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
UNKNOWN_SYSTEM_ACTION = 'input.unknown'
- 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
Use parentheses for method calls with arguments. (https://github.com/voxable-labs/voxable-style-guide#method-invocation-parens) Open
respond_with chunk_class
- 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
Line is too long. [101/80] (https://github.com/voxable-labs/voxable-style-guide#80-character-limits) Open
super('No User class exists for this bot. Define a global class User, or set with user_class=')
- Create a ticketCreate a ticket
- Exclude checks
Missing method documentation comment. Open
def persistent_menu(&block)
yield
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
Missing method documentation comment. Open
def initialize_greeting_text
Facebook::Messenger::Profile.set({
greeting: [
{
locale: 'default',
- 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 "POSTBACK: #{postback.payload}"
- 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 alias
instead of alias_method
in a class body. (https://github.com/voxable-labs/voxable-style-guide#alias-method) Open
alias_method :action_name, :handler_name
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop enforces the use of either #alias
or #alias_method
depending on configuration.
It also flags uses of alias :symbol
rather than alias bareword
.
Example: EnforcedStyle: prefer_alias (default)
# bad
alias_method :bar, :foo
alias :bar :foo
# good
alias bar foo
Example: EnforcedStyle: preferaliasmethod
# bad
alias :bar :foo
alias bar foo
# good
alias_method :bar, :foo
Use alias
instead of alias_method
in a class body. (https://github.com/voxable-labs/voxable-style-guide#alias-method) Open
alias_method :before_handler, :before_action
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop enforces the use of either #alias
or #alias_method
depending on configuration.
It also flags uses of alias :symbol
rather than alias bareword
.
Example: EnforcedStyle: prefer_alias (default)
# bad
alias_method :bar, :foo
alias :bar :foo
# good
alias bar foo
Example: EnforcedStyle: preferaliasmethod
# bad
alias :bar :foo
alias bar foo
# good
alias_method :bar, :foo