Showing 130 of 130 total issues
Line is too long. [82/80] Open
# not including elements already existing for which the score was updated.
- Exclude checks
Missing top-level module documentation comment. Open
module Geo
- 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. [83/80] Open
EMPTY_BULK_STRING_RESPONSE = "#{BULK_STRING}0#{TERMINATOR}#{TERMINATOR}".freeze
- Exclude checks
Missing top-level module documentation comment. Open
module Protocol
- 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. [82/80] Open
# Or the current field content or the specified increment are not parsable
- Exclude checks
Missing top-level module documentation comment. Open
module Hashes
- 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. [81/80] Open
# defaults to meters: m (meters), km (kilometers), mi (miles), ft (feet).
- Exclude checks
Line is too long. [81/80] Open
# @option opts [Array<Integer, Integer>] :limit Get a range of the matching
- Exclude checks
Provide an exception class and message as arguments to raise
. Open
raise Redis::ProtocolError.new(e.message)
- Read upRead up
- 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"
Prefer single-quoted strings when you don't need string interpolation or special symbols. Open
spec.add_development_dependency 'rspec', "~> 3.4"
- Read upRead up
- Exclude checks
Checks if uses of quotes match the configured preference.
Example: EnforcedStyle: single_quotes (default)
# bad
"No special symbols"
"No string interpolation"
"Just text"
# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"
Example: EnforcedStyle: double_quotes
# bad
'Just some text'
'No special chars or interpolation'
# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"
Line is too long. [81/80] Open
# sorted set score of the item, in the form of a 52 bit unsigned integer.
- Exclude checks
Line is too long. [86/80] Open
x.report('Oxblood') { Oxblood::Protocol.build_command(command_name, *command_args) }
- Exclude checks
Avoid the use of double negation (!!
). Open
!!@socket
- Read upRead up
- Exclude checks
This cop checks for uses of double negation (!!) to convert something to a boolean value. As this is both cryptic and usually redundant, it should be avoided.
Example:
# bad
!!something
# good
!something.nil?
Please, note that when something is a boolean value !!something and !something.nil? are not the same thing. As you're unlikely to write code that can accept values of any type this is rarely a problem in practice.
Use Kernel#loop
for infinite loops. Open
end while true
- Read upRead up
- Exclude checks
Use Kernel#loop
for infinite loops.
Example:
# bad
while true
work
end
# good
loop do
work
end
Line is too long. [84/80] Open
# @option opts [String] :host ('localhost') Hostname or IP address to connect to
- Exclude checks
Missing top-level module documentation comment. Open
module Keys
- 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
Use array literal []
instead of Array.new
. Open
@commands = Array.new
- Read upRead up
- Exclude checks
This cop checks for the use of a method, the result of which would be a literal, like an empty array, hash or string.
Example:
# bad
a = Array.new
h = Hash.new
s = String.new
# good
a = []
h = {}
s = ''
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[:aggregate]
- 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
# @option opts [Array<Integer, Integer>] :limit Get a range of the matching
- Exclude checks
Line is too long. [82/80] Open
# @return [Integer] 1 if field is a new field in the hash and value was set.
- Exclude checks