Showing 436 of 436 total issues
Missing method documentation comment. Open
def t(*args)
I18n.t(*args)
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
Line is too long. [81/80] (https://github.com/voxable-labs/voxable-style-guide#80-character-limits) Open
# Note that it's probably a good idea to store your action names as constants.
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [95/80] (https://github.com/voxable-labs/voxable-style-guide#80-character-limits) Open
# @param action_name [String, Symbol] The name of the action to be matched by the router.
- Create a ticketCreate a ticket
- Exclude checks
Use alias
instead of alias_method
in a class body. (https://github.com/voxable-labs/voxable-style-guide#alias-method) Open
alias_method :append_around_handler, :append_around_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
Use alias
instead of alias_method
in a class body. (https://github.com/voxable-labs/voxable-style-guide#alias-method) Open
alias_method :prepend_around_handler, :prepend_around_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
URI.decode
method is obsolete and should not be used. Instead, use CGI.unescape
, URI.decode_www_form
or URI.decode_www_form_component
depending on your specific use case. Open
payload = JSON.parse(URI.decode(referral.ref))
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop identifies places where URI.escape
can be replaced by
CGI.escape
, URI.encode_www_form
or URI.encode_www_form_component
depending on your specific use case.
Also this cop identifies places where URI.unescape
can be replaced by
CGI.unescape
, URI.decode_www_form
or URI.decode_www_form_component
depending on your specific use case.
Example:
# bad
URI.escape('http://example.com')
URI.encode('http://example.com')
# good
CGI.escape('http://example.com')
URI.encode_www_form([['example', 'param'], ['lang', 'en']])
URI.encode_www_form(page: 10, locale: 'en')
URI.encode_www_form_component('http://example.com')
# bad
URI.unescape(enc_uri)
URI.decode(enc_uri)
# good
CGI.unescape(enc_uri)
URI.decode_www_form(enc_uri)
URI.decode_www_form_component(enc_uri)
Missing method documentation comment. Open
def redirect_to(payload = {})
request.action = payload[:action]
request.intent = payload[:action] || payload[:intent]
request.route = payload[:route]
# TODO: Seems like we need a method for fetching params value.
- 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
Do not use parentheses for method calls with no arguments. (https://github.com/voxable-labs/voxable-style-guide#method-invocation-parens) Open
logger.error e.backtrace.join()
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for unwanted parentheses in parameterless method calls.
Example:
# bad
object.some_method()
# good
object.some_method
if
condition requires an else
-clause. Open
if ENV['CHATBASE_API_KEY']
ChatbaseAPIClient.new.send_bot_message(message_text, response)
end
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Freeze mutable objects assigned to constants. Open
DISPLAY_CHUNK = 'display_chunk'
- 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
Freeze mutable objects assigned to constants. Open
HANDLE_COORDINATES = 'handle_coordinates'
- 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
Align .query
with .new
on line 48. Open
.query(text, context_name: user.dialogflow_context_name)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks the indentation of the method name part in method calls that span more than one line.
Example: EnforcedStyle: aligned
# bad
while myvariable
.b
# do something
end
# good
while myvariable
.b
# do something
end
# good
Thing.a
.b
.c
Example: EnforcedStyle: indented
# good
while myvariable
.b
# do something
end
Example: EnforcedStyle: indentedrelativeto_receiver
# good
while myvariable
.a
.b
# do something
end
# good
myvariable = Thing
.a
.b
.c
=
is not aligned with the preceding assignment. Open
config.autoload_paths += AUTOLOAD_PATHS
- 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. [94/80] (https://github.com/voxable-labs/voxable-style-guide#80-character-limits) Open
user.update_attributes(dialogflow_context_name: nil) if user.dialogflow_context_name
- Create a ticketCreate a ticket
- Exclude checks
Use parentheses for method calls with arguments. (https://github.com/voxable-labs/voxable-style-guide#method-invocation-parens) Open
ChatbaseAPIClient.new(
intent: intent,
text: text,
not_handled: not_handled
).send_user_message message
- 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
=
is not aligned with the following assignment. Open
route = routes.fetch(request.action)
- 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 Engine < ::Rails::Engine
- 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
Line is too long. [84/80] (https://github.com/voxable-labs/voxable-style-guide#80-character-limits) Open
# should use the same set of action and parameter names, so that `request` objects
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [84/80] (https://github.com/voxable-labs/voxable-style-guide#80-character-limits) Open
# Since the class itself is the router, make it immutable for thread-safety.
- Create a ticketCreate a ticket
- Exclude checks
Use alias
instead of alias_method
in a class body. (https://github.com/voxable-labs/voxable-style-guide#alias-method) Open
alias_method :reply, :respond
- 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