18F/e-manifest

View on GitHub
app/controllers/api/v0/signatures_controller.rb

Summary

Maintainability
A
0 mins
Test Coverage

Method has too many lines. [12/10]
Open

  def create
    manifest = find_manifest(params[:manifest_id])
    signature_request = read_body_as_json(symbolize_names: true)
    authorize manifest, :can_submit?

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Assignment Branch Condition size for create is too high. [16.4/15]
Open

  def create
    manifest = find_manifest(params[:manifest_id])
    signature_request = read_body_as_json(symbolize_names: true)
    authorize manifest, :can_submit?

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Use a guard clause instead of wrapping the code inside a conditional expression.
Open

    if validate_signature(signature_request)

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. [108/80]
Open

      shared_org_ids.include?(uor.organization_id) && uor.role.tsdf_certifier? && uor.cdx_status == 'Active'

Line is too long. [91/80]
Open

                                                                user_session: user_session,

Use nested module/class definitions instead of compact style.
Open

class Api::V0::SignaturesController < ApiController

This cop checks the style of children definitions at classes and modules. Basically there are two different styles:

Example: EnforcedStyle: nested (default)

# good
# have each child on its own line
class Foo
  class Bar
  end
end

Example: EnforcedStyle: compact

# good
# combine definitions as much as possible
class Foo::Bar
end

The compact style is only forced for classes/modules with one child.

Trailing whitespace detected.
Open

  

Line is too long. [83/80]
Open

      cdx_response = ManifestSigner.new(signature_request.merge(manifest: manifest,

Trailing whitespace detected.
Open

    current_user.user_org_roles.select do |uor| 

Line is too long. [91/80]
Open

                                                                current_user: current_user,

Missing top-level class documentation comment.
Open

class Api::V0::SignaturesController < ApiController

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

Line is too long. [118/80]
Open

                                                                cdx_user_role_id: cdx_user_role_id(manifest))).perform

There are no issues that match your filters.

Category
Status