app/models/user.rb
Line is too long. [87/80] Open
Open
user_org_roles.select { |user_org_role| user_org_role.cdx_status == 'Active' }.any?
- Exclude checks
Missing top-level class documentation comment. Open
Open
class User < ActiveRecord::Base
- 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
Rename has_role_for_org?
to role_for_org?
. Open
Open
def has_role_for_org?(org_name, role_name)
- Read upRead up
- Exclude checks
This cop makes sure that predicates are named properly.
Example:
# bad
def is_even?(value)
end
# good
def even?(value)
end
# bad
def has_value?
end
# good
def value?
end
Pass &:tsdf_certifier?
as an argument to select
instead of a block. Open
Open
roles.select { |role| role.tsdf_certifier? }.any?
- Read upRead up
- Exclude checks
Use symbols as procs when possible.
Example:
# bad
something.map { |s| s.upcase }
# good
something.map(&:upcase)
Use a guard clause instead of wrapping the code inside a conditional expression. Open
Open
if has_role_for_org?(org_name, role_name)
- 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
Pass &:state_data_download?
as an argument to select
instead of a block. Open
Open
roles.select { |role| role.state_data_download? }.any?
- Read upRead up
- Exclude checks
Use symbols as procs when possible.
Example:
# bad
something.map { |s| s.upcase }
# good
something.map(&:upcase)
Line is too long. [106/80] Open
Open
user_org_role.organization.cdx_org_name == org_name && user_org_role.role.cdx_role_name == role_name
- Exclude checks
Pass &:epa_data_download?
as an argument to select
instead of a block. Open
Open
roles.select { |role| role.epa_data_download? }.any?
- Read upRead up
- Exclude checks
Use symbols as procs when possible.
Example:
# bad
something.map { |s| s.upcase }
# good
something.map(&:upcase)