expertiza/expertiza

View on GitHub
app/models/checkbox.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
92%

Class has too many lines. [121/100]
Open

class Checkbox < UnscoredQuestion
  include ActionView::Helpers
  # This method returns what to display if an instructor (etc.) is creating or editing a questionnaire (questionnaires_controller.rb)
  def edit(count)
    html = edit_remove_button(count) + edit_seq(count) + edit_question(count)
Severity: Minor
Found in app/models/checkbox.rb by rubocop

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

Assignment Branch Condition size for complete is too high. [18.36/15]
Open

  def complete(count, answer = nil)
    html = check_previous_question + complete_first_second_input(count, answer)
    html += complete_third_input(count, answer)
    html += '<label for="responses_' + count.to_s + '">&nbsp;&nbsp;' + txt + '</label>'
    html += complete_script(count)
Severity: Minor
Found in app/models/checkbox.rb by rubocop

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

Assignment Branch Condition size for complete_first_second_input is too high. [17.58/15]
Open

  def complete_first_second_input(count, answer = nil)
    html = '<input id="responses_' + count.to_s + '_comments" name="responses[' + count.to_s + '][comment]" type="hidden" value="">'
    html += '<input id="responses_' + count.to_s + '_score" name="responses[' + count.to_s + '][score]" type="hidden"'
    html += if !answer.nil? && (answer.answer == 1)
              'value="1"'
Severity: Minor
Found in app/models/checkbox.rb by rubocop

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

Assignment Branch Condition size for view_question_text is too high. [16.64/15]
Open

  def view_question_text
    html = '<TR><TD align="left"> ' + txt + ' </TD>'
    html += '<TD align="left">' + type + '</TD>'
    html += '<td align="center">' + weight.to_s + '</TD>'
    html += '<TD align="center">Checked/Unchecked</TD>'
Severity: Minor
Found in app/models/checkbox.rb by rubocop

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

Assignment Branch Condition size for complete_script is too high. [15.81/15]
Open

  def complete_script(count)
    html = '<script>function checkbox' + count.to_s + 'Changed() {'
    html += ' var checkbox = jQuery("#responses_' + count.to_s + '_checkbox");'
    html += ' var response_score = jQuery("#responses_' + count.to_s + '_score");'
    html += 'if (checkbox.is(":checked")) {'
Severity: Minor
Found in app/models/checkbox.rb by rubocop

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

Missing top-level class documentation comment.
Open

class Checkbox < UnscoredQuestion
Severity: Minor
Found in app/models/checkbox.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

There are no issues that match your filters.

Category
Status