Method has too many lines. [21/10] (https://github.com/voxable-labs/voxable-style-guide#short-methods) Open
def perform(user_id, redis_namespace, bot_class_name)
# Retrieve the latest postback for this user
raw_postback = pop_raw_postback(user_id, redis_namespace)
# Do nothing if no postback available. This could be due to multiple
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Assignment Branch Condition size for perform is too high. [18.81/15] (http://c2.com/cgi/wiki?AbcMetric) Open
def perform(user_id, redis_namespace, bot_class_name)
# Retrieve the latest postback for this user
raw_postback = pop_raw_postback(user_id, redis_namespace)
# Do nothing if no postback available. This could be due to multiple
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Method perform
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def perform(user_id, redis_namespace, bot_class_name)
# Retrieve the latest postback for this user
raw_postback = pop_raw_postback(user_id, redis_namespace)
# Do nothing if no postback available. This could be due to multiple
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
TODO found Open
# TODO: Make number of retries configurable.
- Create a ticketCreate a ticket
- Exclude checks
TODO found Open
# TODO: pass in a `user_id_field` to indicate how to find user in order to
- Create a ticketCreate a ticket
- Exclude checks
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)
- 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
build_referral_request @referral, user
- 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. [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
- 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
build_payload_request @postback.payload, user
- 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. [84/80] (https://github.com/voxable-labs/voxable-style-guide#80-character-limits) Open
# @param user_id [String, Integer] The ID representing the user on this platform
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [81/80] (https://github.com/voxable-labs/voxable-style-guide#80-character-limits) Open
@referral = Facebook::Messenger::Incoming::Referral.new(raw_postback)
- Create a ticketCreate a ticket
- Exclude checks
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
Favor a normal if-statement over a modifier clause in a multiline statement. (https://github.com/voxable-labs/voxable-style-guide#no-multiline-if-modifiers) Open
send_user_message(
intent: request.action,
text: request.action,
not_handled: false,
message: @postback || @referral
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Checks for uses of if/unless modifiers with multiple-lines bodies.
Example:
# bad
{
result: 'this should not happen'
} unless cond
# good
{ result: 'ok' } if cond