18F/e-manifest

View on GitHub
app/models/user.rb

Summary

Maintainability
A
0 mins
Test Coverage

Line is too long. [87/80]
Open

    user_org_roles.select { |user_org_role| user_org_role.cdx_status == 'Active' }.any?
Severity: Minor
Found in app/models/user.rb by rubocop

Missing top-level class documentation comment.
Open

class User < ActiveRecord::Base
Severity: Minor
Found in app/models/user.rb by rubocop

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

  def has_role_for_org?(org_name, role_name)
Severity: Minor
Found in app/models/user.rb by rubocop

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

    roles.select { |role| role.tsdf_certifier? }.any?
Severity: Minor
Found in app/models/user.rb by rubocop

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

    if has_role_for_org?(org_name, role_name)
Severity: Minor
Found in app/models/user.rb by rubocop

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

    roles.select { |role| role.state_data_download? }.any?
Severity: Minor
Found in app/models/user.rb by rubocop

Use symbols as procs when possible.

Example:

# bad
something.map { |s| s.upcase }

# good
something.map(&:upcase)

Line is too long. [106/80]
Open

      user_org_role.organization.cdx_org_name == org_name && user_org_role.role.cdx_role_name == role_name
Severity: Minor
Found in app/models/user.rb by rubocop

Pass &:epa_data_download? as an argument to select instead of a block.
Open

    roles.select { |role| role.epa_data_download? }.any?
Severity: Minor
Found in app/models/user.rb by rubocop

Use symbols as procs when possible.

Example:

# bad
something.map { |s| s.upcase }

# good
something.map(&:upcase)

There are no issues that match your filters.

Category
Status