Showing 939 of 939 total issues
Prefer single-quoted strings when you don't need string interpolation or special symbols. Open
config.redis = { url: ENV.fetch("REDIS_URL") { "redis://redis:6379" } }
- 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"
Use the new Ruby 1.9 hash syntax. Open
:enable_starttls_auto => true
- Read upRead up
- Exclude checks
This cop checks hash literal syntax.
It can enforce either the use of the class hash rocket syntax or the use of the newer Ruby 1.9 syntax (when applicable).
A separate offense is registered for each problematic pair.
The supported styles are:
- ruby19 - forces use of the 1.9 syntax (e.g.
{a: 1}
) when hashes have all symbols for keys - hash_rockets - forces use of hash rockets for all hashes
- nomixedkeys - simply checks for hashes with mixed syntaxes
- ruby19nomixed_keys - forces use of ruby 1.9 syntax and forbids mixed syntax hashes
Example: EnforcedStyle: ruby19 (default)
# bad
{:a => 2}
{b: 1, :c => 2}
# good
{a: 2, b: 1}
{:c => 2, 'd' => 2} # acceptable since 'd' isn't a symbol
{d: 1, 'e' => 2} # technically not forbidden
Example: EnforcedStyle: hash_rockets
# bad
{a: 1, b: 2}
{c: 1, 'd' => 5}
# good
{:a => 1, :b => 2}
Example: EnforcedStyle: nomixedkeys
# bad
{:a => 1, b: 2}
{c: 1, 'd' => 2}
# good
{:a => 1, :b => 2}
{c: 1, d: 2}
Example: EnforcedStyle: ruby19nomixed_keys
# bad
{:a => 1, :b => 2}
{c: 2, 'd' => 3} # should just use hash rockets
# good
{a: 1, b: 2}
{:c => 3, 'd' => 4}
Line is too long. [96/80] Open
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
- Exclude checks
Line is too long. [102/80] Open
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
- Exclude checks
Favor modifier if
usage when having a single-line body. Another good alternative is the usage of control flow &&
/||
. Open
if Rails.env.test?
- Read upRead up
- Exclude checks
Checks for if and unless statements that would fit on one line
if written as a modifier if/unless. The maximum line length is
configured in the Metrics/LineLength
cop.
Example:
# bad
if condition
do_stuff(bar)
end
unless qux.empty?
Foo.do_something
end
# good
do_stuff(bar) if condition
Foo.do_something unless qux.empty?
Line is too long. [85/80] Open
# Settings specified here will take precedence over those in config/application.rb.
- Exclude checks
Line is too long. [93/80] Open
# config.exception_level_filters.merge!('MyCriticalException' => lambda { |e| 'critical' })
- Exclude checks
Line is too long. [83/80] Open
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
- Exclude checks
Line is too long. [96/80] Open
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
- Exclude checks
Line is too long. [100/80] Open
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
- Exclude checks
Prefer single-quoted strings when you don't need string interpolation or special symbols. Open
if ENV["RAILS_LOG_TO_STDOUT"].present?
- 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"
Favor modifier if
usage when having a single-line body. Another good alternative is the usage of control flow &&
/||
. Open
if ENV["REDISCLOUD_URL"]
- Read upRead up
- Exclude checks
Checks for if and unless statements that would fit on one line
if written as a modifier if/unless. The maximum line length is
configured in the Metrics/LineLength
cop.
Example:
# bad
if condition
do_stuff(bar)
end
unless qux.empty?
Foo.do_something
end
# good
do_stuff(bar) if condition
Foo.do_something unless qux.empty?
Line is too long. [86/80] Open
# You can also specify a callable, which will be called with the exception instance.
- Exclude checks
Do not use space inside array brackets. Open
config.log_tags = [ :request_id ]
- Read upRead up
- Exclude checks
Checks that brackets used for array literals have or don't have surrounding space depending on configuration.
Example: EnforcedStyle: space
# The `space` style enforces that array literals have
# surrounding space.
# bad
array = [a, b, c, d]
# good
array = [ a, b, c, d ]
Example: EnforcedStyle: no_space
# The `no_space` style enforces that array literals have
# no surrounding space.
# bad
array = [ a, b, c, d ]
# good
array = [a, b, c, d]
Example: EnforcedStyle: compact
# The `compact` style normally requires a space inside
# array brackets, with the exception that successive left
# or right brackets are collapsed together in nested arrays.
# bad
array = [ a, [ b, c ] ]
# good
array = [ a, [ b, c ]]
Line is too long. [96/80] Open
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
- Exclude checks
Line is too long. [85/80] Open
# Settings specified here will take precedence over those in config/application.rb.
- Exclude checks
Line is too long. [88/80] Open
# Do not halt callback chains when a callback returns false. Previous versions had true.
- Exclude checks
Line is too long. [84/80] Open
# Configure SSL options to enable HSTS with subdomains. Previous versions had false.
- Exclude checks
Line is too long. [86/80] Open
@default || req.headers['Accept'].include?("application/vnd.reporte.v#{@version}")
- Exclude checks