Showing 130 of 130 total issues
Line is too long. [83/80] Open
# Remove all members in a sorted set between the given lexicographical range.
- Exclude checks
Line is too long. [81/80] Open
# sorted set score of the item, in the form of a 52 bit unsigned integer.
- Exclude checks
Use a guard clause instead of wrapping the code inside a conditional expression. Open
if storedist_key = opts[:storedist]
- Read upRead up
- Exclude checks
Use a guard clause instead of wrapping the code inside a conditional expression
Example:
# bad
def test
if something
work
end
end
# good
def test
return unless something
work
end
# also good
def test
work if something
end
# bad
if something
raise 'exception'
else
ok
end
# good
raise 'exception' if something
ok
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[:weights]
- 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. [82/80] Open
# Add one or more members to a sorted set, or update its score if it already
- Exclude checks
Use a guard clause instead of wrapping the code inside a conditional expression. Open
if v = opts[:match]
- Read upRead up
- Exclude checks
Use a guard clause instead of wrapping the code inside a conditional expression
Example:
# bad
def test
if something
work
end
end
# good
def test
return unless something
work
end
# also good
def test
work if something
end
# bad
if something
raise 'exception'
else
ok
end
# good
raise 'exception' if something
ok
Line is too long. [81/80] Open
# returns an array of elements, or an empty array when key does not exist
- Exclude checks
Line is too long. [88/80] Open
# @note Will raise RSocket::TimeoutError even if there is simply no response to read
- Exclude checks
Literal true
appeared as a condition. Open
end while true
- Read upRead up
- Exclude checks
This cop checks for literals used as the conditions or as operands in and/or expressions serving as the conditions of if/while/until.
Example:
# bad
if 20
do_something
end
Example:
# bad
if some_var && true
do_something
end
Example:
# good
if some_var && some_condition
do_something
end
Do not use semicolons to terminate expressions. Open
;
- Read upRead up
- Exclude checks
This cop checks for multiple expressions placed on the same line. It also checks for lines terminated with a semicolon.
Example:
# bad
foo = 1; bar = 2;
baz = 3;
# good
foo = 1
bar = 2
baz = 3
Missing top-level module documentation comment. Open
module Strings
- 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 ==
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[:type]
- 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. [84/80] Open
# Return a range of members in a sorted set, by lexicographical range, ordered
- Exclude checks
Line is too long. [91/80] Open
reply = CommandError.new(reply.message) if reply.is_a?(::Oxblood::Protocol::RError)
- Exclude checks
Dependencies should be sorted in an alphabetical order within their section of the gemspec. Dependency pry
should appear before rspec
. Open
spec.add_development_dependency 'pry'
- Read upRead up
- Exclude checks
Dependencies in the gemspec should be alphabetically sorted.
Example:
# bad
spec.add_dependency 'rubocop'
spec.add_dependency 'rspec'
# good
spec.add_dependency 'rspec'
spec.add_dependency 'rubocop'
# good
spec.add_dependency 'rubocop'
spec.add_dependency 'rspec'
# bad
spec.add_development_dependency 'rubocop'
spec.add_development_dependency 'rspec'
# good
spec.add_development_dependency 'rspec'
spec.add_development_dependency 'rubocop'
# good
spec.add_development_dependency 'rubocop'
spec.add_development_dependency 'rspec'
# bad
spec.add_runtime_dependency 'rubocop'
spec.add_runtime_dependency 'rspec'
# good
spec.add_runtime_dependency 'rspec'
spec.add_runtime_dependency 'rubocop'
# good
spec.add_runtime_dependency 'rubocop'
spec.add_runtime_dependency 'rspec'
# good only if TreatCommentsAsGroupSeparators is true
# For code quality
spec.add_dependency 'rubocop'
# For tests
spec.add_dependency 'rspec'
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 Commands
- 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
Do not suppress exceptions. Open
rescue IOError
- Read upRead up
- Exclude checks
This cop checks for rescue blocks with no body.
Example:
# bad
def some_method
do_something
rescue
# do nothing
end
Example:
# bad
begin
do_something
rescue
# do nothing
end
Example:
# good
def some_method
do_something
rescue
handle_exception
end
Example:
# good
begin
do_something
rescue
handle_exception
end
Line is too long. [84/80] Open
Gem::Version.new(JRUBY_VERSION) < Gem::Version.new('9.1.6.0')
- Exclude checks
Avoid the use of the case equality operator ===
. Open
if Array === c
- Read upRead up
- Exclude checks
This cop checks for uses of the case equality operator(===).
Example:
# bad
Array === something
(1..100) === 7
/something/ === some_string
# good
something.is_a?(Array)
(1..100).include?(7)
some_string =~ /something/