config/initializers/rails_admin.rb
Trailing whitespace detected. Open
Open
- Exclude checks
Prefer !expression.nil?
over expression != nil
. Open
Open
redirect_to main_app.new_user_session_path unless current_user != nil and current_user.admin == true
- Read upRead up
- Exclude checks
This cop checks for non-nil checks, which are usually redundant.
Example:
# bad
if x != nil
end
# good (when not allowing semantic changes)
# bad (when allowing semantic changes)
if !x.nil?
end
# good (when allowing semantic changes)
if x
end
Non-nil checks are allowed if they are the final nodes of predicate.
# good
def signed_in?
!current_user.nil?
end
Use &&
instead of and
. Open
Open
redirect_to main_app.new_user_session_path unless current_user != nil and current_user.admin == true
- 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. [87/80] Open
Open
# config.audit_with :paper_trail, 'User', 'PaperTrail::Version' # PaperTrail >= 3.0.0
- Exclude checks
Line is too long. [104/80] Open
Open
redirect_to main_app.new_user_session_path unless current_user != nil and current_user.admin == true
- Exclude checks