Showing 130 of 130 total issues
Method common_rangebylex
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def common_rangebylex(command_name, key, min, max, opts)
Method georadiusbymember
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def georadiusbymember(key, member, radius, unit, opts = {})
Method add_georadius_opts!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def add_georadius_opts!(args, opts)
args << :WITHCOORD if opts[:withcoord]
args << :WITHDIST if opts[:withdist]
args << :WITHHASH if opts[:withhash]
- Read upRead up
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
Avoid parameter lists longer than 5 parameters. [6/5] Open
def georadius(key, longitude, latitude, radius, unit, opts = {})
- Read upRead up
- Exclude checks
This cop checks for methods with too many parameters. The maximum number of parameters is configurable. Keyword arguments can optionally be excluded from the total count.
Line is too long. [81/80] Open
# @option opts [Boolean] :replace (false) Override key if it already exists
- Exclude checks
Line is too long. [82/80] Open
# @return [String] the requested element, or nil when index is out of range.
- Exclude checks
Use ==
if you meant to do a comparison or wrap the expression in parentheses to indicate you meant to assign in a condition. Open
if order = opts[:order]
- Read upRead up
- 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
Use ==
if you meant to do a comparison or wrap the expression in parentheses to indicate you meant to assign in a condition. Open
if store_key = opts[:store]
- Read upRead up
- 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
Extra blank line detected. Open
def fail_with_timeout!
- Read upRead up
- Exclude checks
This cops checks for two or more consecutive blank lines.
Example:
# bad - It has two empty lines.
some_method
# one empty line
# two empty lines
some_method
# good
some_method
# one empty line
some_method
Use ||
instead of or
. Open
socket.wait_readable(timeout) or fail_with_timeout!
- Read upRead up
- Exclude checks
This cop checks for uses of and
and or
, and suggests using &&
and
|| instead
. It can be configured to check only in conditions, or in
all contexts.
Example: EnforcedStyle: always (default)
# bad
foo.save and return
# bad
if foo and bar
end
# good
foo.save && return
# good
if foo && bar
end
Example: EnforcedStyle: conditionals
# bad
if foo and bar
end
# good
foo.save && return
# good
foo.save and return
# good
if foo && bar
end
Line is too long. [81/80] Open
# @return [String] raw redis server response as a collection of text lines.
- Exclude checks
Line is too long. [86/80] Open
# @option opts [Integer] :count limit the results to the first N matching items.
- Exclude checks
Line is too long. [81/80] Open
# @return [Integer] the cardinality (number of elements) of the sorted set,
- Exclude checks
Line is too long. [82/80] Open
# @return [Integer] the cardinality (number of elements) of the set, or 0 if
- Exclude checks
Missing top-level class documentation comment. Open
class Oxblood
- Read upRead up
- 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. [104/80] Open
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
- Exclude checks
Line is too long. [81/80] Open
# @return [Integer] the number of keys existing among the ones specified as
- Exclude checks
Use ==
if you meant to do a comparison or wrap the expression in parentheses to indicate you meant to assign in a condition. Open
if v = opts_or_addr[:addr]
- Read upRead up
- 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
Line is too long. [81/80] Open
# of specified type (for example: `normal`, `master`, `slave`, `pubsub`).
- Exclude checks
Line is too long. [81/80] Open
# @return [String, nil] the value of the last element, or nil when key does
- Exclude checks