Showing 1,937 of 1,937 total issues
Prefer $ERROR_INFO
from the stdlib 'English' module (don't forget to require it) over $!
. Open
Open
$!.additional_information[:event] = event
- Exclude checks
Line is too long. [106/80] Open
Open
rescue Exception # rescues StandardError by default; but we want to rescue and report all errors
- Exclude checks
Use Integer
instead of Fixnum
. Open
Open
options = { max_tries: options } if options.is_a?(Fixnum)
- Read upRead up
- Exclude checks
This cop checks for using Fixnum or Bignum constant.
Example:
# bad
1.is_a?(Fixnum)
1.is_a?(Bignum)
Example:
# good
1.is_a?(Integer)
Prefer single-quoted strings when you don't need string interpolation or special symbols. Open
Open
super(string || "{}")
- 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. [82/80] Open
Open
Rails.logger.warn "\e[31m[try] \e[1m#{$!.class}\e[0;31m: #{$!.message}\e[0m"
- Exclude checks
Extra empty line detected at module body end. Open
Open
end
- Read upRead up
- Exclude checks
This cops checks if empty lines around the bodies of modules match the configuration.
Example: EnforcedStyle: empty_lines
# good
module Foo
def bar
# ...
end
end
Example: EnforcedStyle: emptylinesexcept_namespace
# good
module Foo
module Bar
# ...
end
end
Example: EnforcedStyle: emptylinesspecial
# good
module Foo
def bar; end
end
Example: EnforcedStyle: noemptylines (default)
# good
module Foo
def bar
# ...
end
end
Trailing whitespace detected. Open
Open
#
- Exclude checks
Line is too long. [85/80] Open
Open
raise UnregisteredEventError, "#{event_name.inspect} is not a registered event"
- Exclude checks
Trailing whitespace detected. Open
Open
- Exclude checks
Use a guard clause instead of wrapping the code inside a conditional expression. Open
Open
if unregistered_params.any?
- 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. [86/80] Open
Open
longest_params = Houston.events.map { |event| event.params.join(", ").length }.max
- Exclude checks
Prefer to_s
over string interpolation. Open
Open
params = "#{event.params.join(", ")}" if event.params.any?
- Read upRead up
- Exclude checks
This cop checks for strings that are just an interpolated expression.
Example:
# bad
"#{@var}"
# good
@var.to_s
# good if @var is already a String
@var
Line is too long. [105/80] Open
Open
raise ArgumentError, "params must be a Hash, but it is a #{object.class}" unless object.is_a?(Hash)
- Exclude checks
Line is too long. [109/80] Open
Open
puts " \e[36m#{action.name.ljust(longest_name)}\e[0m \e[96m#{params.to_s.ljust(longest_params)}\e[0m"
- Exclude checks
Prefer single-quoted strings inside interpolations. Open
Open
params = "#{event.params.join(", ")}" if event.params.any?
- Read upRead up
- Exclude checks
This cop checks that quotes inside the string interpolation match the configured preference.
Example: EnforcedStyle: single_quotes (default)
# bad
result = "Tests #{success ? "PASS" : "FAIL"}"
# good
result = "Tests #{success ? 'PASS' : 'FAIL'}"
Example: EnforcedStyle: double_quotes
# bad
result = "Tests #{success ? 'PASS' : 'FAIL'}"
# good
result = "Tests #{success ? "PASS" : "FAIL"}"
Prefer single-quoted strings when you don't need string interpolation or special symbols. Open
Open
longest_params = Houston.events.map { |event| event.params.join(", ").length }.max
- 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"
Prefer single-quoted strings when you don't need string interpolation or special symbols. Open
Open
gem "pry"
- 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. [90/80] Open
Open
longest_params = actions.map { |action| action.required_params.join(", ").length }.max
- Exclude checks
Gems should be sorted in an alphabetical order within their section of the Gemfile. Gem rr
should appear before timecop
. Open
Open
gem "rr"
- 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'
Prefer single-quoted strings when you don't need string interpolation or special symbols. Open
Open
gem "factory_girl_rails", "4.9.0"
- 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"