expertiza/expertiza

View on GitHub
app/controllers/sample_reviews_controller.rb

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

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

  def map_to_assignment
    params[:assignments].each do |assignment_id|
      @sample_review = SampleReview.create(response_id: params[:id], assignment_id: assignment_id)
    end
    @response = Response.find(params[:id])

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.

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

  def unmap_from_assignment
    SampleReview.where(response_id: params[:id]).delete_all

    @response = Response.find(params[:id])
    begin

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 map_to_assignment is too high. [18.06/15]
Open

  def map_to_assignment
    params[:assignments].each do |assignment_id|
      @sample_review = SampleReview.create(response_id: params[:id], assignment_id: assignment_id)
    end
    @response = Response.find(params[:id])

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

Omit parentheses for ternary conditions.
Open

      ((%w[list].include? action_name) ? are_needed_authorizations_present?(params[:id], 'submitter') : true)

This cop checks for the presence of parentheses around ternary conditions. It is configurable to enforce inclusion or omission of parentheses using EnforcedStyle. Omission is only enforced when removing the parentheses won't cause a different behavior.

Example: EnforcedStyle: requirenoparentheses (default)

# bad
foo = (bar?) ? a : b
foo = (bar.baz?) ? a : b
foo = (bar && baz) ? a : b

# good
foo = bar? ? a : b
foo = bar.baz? ? a : b
foo = bar && baz ? a : b

Example: EnforcedStyle: require_parentheses

# bad
foo = bar? ? a : b
foo = bar.baz? ? a : b
foo = bar && baz ? a : b

# good
foo = (bar?) ? a : b
foo = (bar.baz?) ? a : b
foo = (bar && baz) ? a : b

Example: EnforcedStyle: requireparentheseswhen_complex

# bad
foo = (bar?) ? a : b
foo = (bar.baz?) ? a : b
foo = bar && baz ? a : b

# good
foo = bar? ? a : b
foo = bar.baz? ? a : b
foo = (bar && baz) ? a : b

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

    unless @response_id.nil?

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

Missing top-level class documentation comment.
Open

class SampleReviewsController < ApplicationController

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

There are no issues that match your filters.

Category
Status