Showing 130 of 130 total issues
Line is too long. [82/80] Open
# Set the expiration for a key as a UNIX timestamp specified in milliseconds
- Exclude checks
Line is too long. [81/80] Open
# items. Two different sorting methods can be invoked using the following
- Exclude checks
Line is too long. [82/80] Open
# like ZINCRBY. Only one score-element pair can be specified in this mode.
- Exclude checks
Line is too long. [81/80] Open
# @return [Array] list of elements in the specified score range (optionally
- Exclude checks
Gems should be sorted in an alphabetical order within their section of the Gemfile. Gem benchmark-ips
should appear before oxblood
. Open
gem 'benchmark-ips'
- Read upRead up
- Exclude checks
Gems should be alphabetically sorted within groups.
Example:
# bad
gem 'rubocop'
gem 'rspec'
# good
gem 'rspec'
gem 'rubocop'
# good
gem 'rubocop'
gem 'rspec'
# good only if TreatCommentsAsGroupSeparators is true
# For code quality
gem 'rubocop'
# For tests
gem 'rspec'
Use ||
instead of or
. Open
socket.wait_writable(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. [82/80] Open
# @return [RError] if replace is false and key already exists or RDB version
- Exclude checks
Line is too long. [81/80] Open
# @return [RError] field contains a value of the wrong type (not a string).
- Exclude checks
Line is too long. [90/80] Open
# the Geohash corresponding to each member name passed as argument to the command.
- Exclude checks
Line is too long. [81/80] Open
# @return [Array] list of elements in the specified score range (optionally
- 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[:count]
- 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
Do not use ::
for method calls. Open
if defined?(Encoding::default_external)
- Read upRead up
- Exclude checks
This cop checks for methods invoked via the :: operator instead of the . operator (like FileUtils::rmdir instead of FileUtils.rmdir).
Example:
# bad
Timeout::timeout(500) { do_something }
FileUtils::rmdir(dir)
Marshal::dump(obj)
# good
Timeout.timeout(500) { do_something }
FileUtils.rmdir(dir)
Marshal.dump(obj)
Gems should be sorted in an alphabetical order within their section of the Gemfile. Gem concurrent-ruby
should appear before redis
. Open
gem 'concurrent-ruby'
- Read upRead up
- Exclude checks
Gems should be alphabetically sorted within groups.
Example:
# bad
gem 'rubocop'
gem 'rspec'
# good
gem 'rspec'
gem 'rubocop'
# good
gem 'rubocop'
gem 'rspec'
# good only if TreatCommentsAsGroupSeparators is true
# For code quality
gem 'rubocop'
# For tests
gem 'rspec'
Missing top-level module documentation comment. Open
module 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
Missing top-level module documentation comment. Open
module Server
- 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. [86/80] Open
# @option opts [Integer] :count limit the results to the first N matching items.
- Exclude checks
Missing top-level module documentation comment. Open
module SortedSets
- 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
# @return [String] without the additional count argument the command returns
- Exclude checks
required_ruby_version
(2.2, declared in oxblood.gemspec) and TargetRubyVersion
(2.1, declared in .rubocop.yml) should be equal. Open
spec.required_ruby_version = '>= 2.2.2'
- Read upRead up
- Exclude checks
Checks that required_ruby_version
of gemspec and TargetRubyVersion
of .rubocop.yml are equal.
Thereby, RuboCop to perform static analysis working on the version
required by gemspec.
Example:
# When `TargetRubyVersion` of .rubocop.yml is `2.3`.
# bad
Gem::Specification.new do |spec|
spec.required_ruby_version = '>= 2.2.0'
end
# bad
Gem::Specification.new do |spec|
spec.required_ruby_version = '>= 2.4.0'
end
# good
Gem::Specification.new do |spec|
spec.required_ruby_version = '>= 2.3.0'
end
# good
Gem::Specification.new do |spec|
spec.required_ruby_version = '>= 2.3'
end
# good
Gem::Specification.new do |spec|
spec.required_ruby_version = ['>= 2.3.0', '< 2.5.0']
end
Avoid the use of the case equality operator ===
. Open
Protocol::RError === response
- 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/