ece517-p3/expertiza

View on GitHub
app/models/response.rb

Summary

Maintainability
B
4 hrs
Test Coverage

Mass assignment is not restricted using attr_accessible
Open

class Response < ActiveRecord::Base
Severity: Critical
Found in app/models/response.rb by brakeman

This warning comes up if a model does not limit what attributes can be set through mass assignment.

In particular, this check looks for attr_accessible inside model definitions. If it is not found, this warning will be issued.

Brakeman also warns on use of attr_protected - especially since it was found to be vulnerable to bypass. Warnings for mass assignment on models using attr_protected will be reported, but at a lower confidence level.

Note that disabling mass assignment globally will suppress these warnings.

Assignment Branch Condition size for concatenate_all_review_comments is too high. [44.33/15]
Open

  def self.concatenate_all_review_comments(assignment_id, reviewer_id)
    comments = ''
    counter = 0
    @comments_in_round1 = @comments_in_round2 = @comments_in_round3 = ''
    @counter_in_round1 = @counter_in_round2 = @counter_in_round3 = 0
Severity: Minor
Found in app/models/response.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 notify_instructor_on_difference is too high. [33.96/15]
Open

  def notify_instructor_on_difference
    response_map = self.map
    reviewer_participant_id = response_map.reviewer_id
    reviewer_participant = AssignmentParticipant.find(reviewer_participant_id)
    reviewer_name = User.find(reviewer_participant.user_id).fullname
Severity: Minor
Found in app/models/response.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 construct_review_response is too high. [27.46/15]
Open

  def construct_review_response code, self_id, show_tags = nil, current_user = nil
    code += '<table id="review_' + self_id + '" style="display: none;" class="table table-bordered">'
    answers = Answer.where(response_id: self.response_id)
    unless answers.empty?
      questionnaire = self.questionnaire_by_answer(answers.first)
Severity: Minor
Found in app/models/response.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 add_table_rows is too high. [26.57/15]
Open

  def add_table_rows questionnaire_max, questions, answers, code, tag_prompt_deployments = nil, current_user = nil
    count = 0
    # loop through questions so the the questions are displayed in order based on seq (sequence number)
    questions.each do |question|
      count += 1 if !question.is_a? QuestionnaireHeader and question.break_before == true
Severity: Minor
Found in app/models/response.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 significant_difference? is too high. [26.94/15]
Open

  def significant_difference?
    map_class = self.map.class
    existing_responses = map_class.get_assessments_for(self.map.reviewee)
    average_score_on_same_artifact_from_others, count = Response.avg_scores_and_count_for_prev_reviews(existing_responses, self)
    # if this response is the first on this artifact, there's no grade conflict
Severity: Minor
Found in app/models/response.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 get_volume_of_review_comments is too high. [26.02/15]
Open

  def self.get_volume_of_review_comments(assignment_id, reviewer_id)
    comments, counter,
        @comments_in_round1, @counter_in_round1,
        @comments_in_round2, @counter_in_round2,
        @comments_in_round3, @counter_in_round3 = Response.concatenate_all_review_comments(assignment_id, reviewer_id)
Severity: Minor
Found in app/models/response.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

Cyclomatic complexity for add_table_rows is too high. [12/6]
Open

  def add_table_rows questionnaire_max, questions, answers, code, tag_prompt_deployments = nil, current_user = nil
    count = 0
    # loop through questions so the the questions are displayed in order based on seq (sequence number)
    questions.each do |question|
      count += 1 if !question.is_a? QuestionnaireHeader and question.break_before == true
Severity: Minor
Found in app/models/response.rb by rubocop

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Perceived complexity for add_table_rows is too high. [13/7]
Open

  def add_table_rows questionnaire_max, questions, answers, code, tag_prompt_deployments = nil, current_user = nil
    count = 0
    # loop through questions so the the questions are displayed in order based on seq (sequence number)
    questions.each do |question|
      count += 1 if !question.is_a? QuestionnaireHeader and question.break_before == true
Severity: Minor
Found in app/models/response.rb by rubocop

This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

Example:

def my_method                   # 1
  if cond                       # 1
    case var                    # 2 (0.8 + 4 * 0.2, rounded)
    when 1 then func_one
    when 2 then func_two
    when 3 then func_three
    when 4..10 then func_other
    end
  else                          # 1
    do_something until a && b   # 2
  end                           # ===
end                             # 7 complexity points

Assignment Branch Condition size for construct_instructor_html is too high. [19.42/15]
Open

  def construct_instructor_html identifier, self_id, count
    identifier += '<h4><B>Review ' + count.to_s + '</B></h4>'
    identifier += '<B>Reviewer: </B>' + self.map.reviewer.fullname + ' (' + self.map.reviewer.name + ')'
    identifier + '&nbsp;&nbsp;&nbsp;<a href="#" name= "review_' + self_id + 'Link" onClick="toggleElement(' \
           "'review_" + self_id + "','review'" + ');return false;">show review</a><BR/>'
Severity: Minor
Found in app/models/response.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

Method add_table_rows has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def add_table_rows questionnaire_max, questions, answers, code, tag_prompt_deployments = nil, current_user = nil
    count = 0
    # loop through questions so the the questions are displayed in order based on seq (sequence number)
    questions.each do |question|
      count += 1 if !question.is_a? QuestionnaireHeader and question.break_before == true
Severity: Minor
Found in app/models/response.rb - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Assignment Branch Condition size for maximum_score is too high. [17.97/15]
Open

  def maximum_score
    # only count the scorable questions, only when the answer is not nil (we accept nil as answer for scorable questions, and they will not be counted towards the total score)
    total_weight = 0
    scores.each do |s|
      question = Question.find(s.question_id)
Severity: Minor
Found in app/models/response.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 display_as_html is too high. [16.25/15]
Open

  def display_as_html(prefix = nil, count = nil, _file_url = nil, show_tags = nil, current_user = nil)
    identifier = ""
    # The following three lines print out the type of rubric before displaying
    # feedback.  Currently this is only done if the rubric is Author Feedback.
    # It doesn't seem necessary to print out the rubric type in the case of
Severity: Minor
Found in app/models/response.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

Method concatenate_all_review_comments has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def self.concatenate_all_review_comments(assignment_id, reviewer_id)
    comments = ''
    counter = 0
    @comments_in_round1 = @comments_in_round2 = @comments_in_round3 = ''
    @counter_in_round1 = @counter_in_round2 = @counter_in_round3 = 0
Severity: Minor
Found in app/models/response.rb - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method add_table_rows has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def add_table_rows questionnaire_max, questions, answers, code, tag_prompt_deployments = nil, current_user = nil
Severity: Minor
Found in app/models/response.rb - About 45 mins to fix

    Method display_as_html has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def display_as_html(prefix = nil, count = nil, _file_url = nil, show_tags = nil, current_user = nil)
    Severity: Minor
    Found in app/models/response.rb - About 35 mins to fix

      Method construct_review_response has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def construct_review_response code, self_id, show_tags = nil, current_user = nil
          code += '<table id="review_' + self_id + '" style="display: none;" class="table table-bordered">'
          answers = Answer.where(response_id: self.response_id)
          unless answers.empty?
            questionnaire = self.questionnaire_by_answer(answers.first)
      Severity: Minor
      Found in app/models/response.rb - About 35 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Specify an :inverse_of option.
      Open

        has_many :metareview_response_maps, class_name: 'MetareviewResponseMap', foreign_key: 'reviewed_object_id', dependent: :destroy
      Severity: Minor
      Found in app/models/response.rb by rubocop

      This cop looks for has(one|many) and belongsto associations where ActiveRecord can't automatically determine the inverse association because of a scope or the options used. This can result in unnecessary queries in some circumstances. :inverse_of must be manually specified for associations to work in both ways, or set to false to opt-out.

      Example:

      # good
      class Blog < ApplicationRecord
        has_many :posts
      end
      
      class Post < ApplicationRecord
        belongs_to :blog
      end

      Example:

      # bad
      class Blog < ApplicationRecord
        has_many :posts, -> { order(published_at: :desc) }
      end
      
      class Post < ApplicationRecord
        belongs_to :blog
      end
      
      # good
      class Blog < ApplicationRecord
        has_many(:posts,
          -> { order(published_at: :desc) },
          inverse_of: :blog
        )
      end
      
      class Post < ApplicationRecord
        belongs_to :blog
      end
      
      # good
      class Blog < ApplicationRecord
        with_options inverse_of: :blog do
          has_many :posts, -> { order(published_at: :desc) }
        end
      end
      
      class Post < ApplicationRecord
        belongs_to :blog
      end

      Example:

      # bad
      class Picture < ApplicationRecord
        belongs_to :imageable, polymorphic: true
      end
      
      class Employee < ApplicationRecord
        has_many :pictures, as: :imageable
      end
      
      class Product < ApplicationRecord
        has_many :pictures, as: :imageable
      end
      
      # good
      class Picture < ApplicationRecord
        belongs_to :imageable, polymorphic: true
      end
      
      class Employee < ApplicationRecord
        has_many :pictures, as: :imageable, inverse_of: :imageable
      end
      
      class Product < ApplicationRecord
        has_many :pictures, as: :imageable, inverse_of: :imageable
      end

      Example:

      # bad
      # However, RuboCop can not detect this pattern...
      class Physician < ApplicationRecord
        has_many :appointments
        has_many :patients, through: :appointments
      end
      
      class Appointment < ApplicationRecord
        belongs_to :physician
        belongs_to :patient
      end
      
      class Patient < ApplicationRecord
        has_many :appointments
        has_many :physicians, through: :appointments
      end
      
      # good
      class Physician < ApplicationRecord
        has_many :appointments
        has_many :patients, through: :appointments
      end
      
      class Appointment < ApplicationRecord
        belongs_to :physician, inverse_of: :appointments
        belongs_to :patient, inverse_of: :appointments
      end
      
      class Patient < ApplicationRecord
        has_many :appointments
        has_many :physicians, through: :appointments
      end

      @see http://guides.rubyonrails.org/association_basics.html#bi-directional-associations @see http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#module-ActiveRecord::Associations::ClassMethods-label-Setting+Inverses

      Tagging a string as html safe may be a security risk.
      Open

          code.html_safe
      Severity: Minor
      Found in app/models/response.rb by rubocop

      This cop checks for the use of output safety calls like htmlsafe, raw, and safeconcat. These methods do not escape content. They simply return a SafeBuffer containing the content as is. Instead, use safe_join to join content and escape it and concat to concatenate content and escape it, ensuring its safety.

      Example:

      user_content = "hi"
      
      # bad
      "

      #{user_content}

      ".html_safe # => ActiveSupport::SafeBuffer "

      hi

      " # good content_tag(:p, user_content) # => ActiveSupport::SafeBuffer "

      <b>hi</b>

      " # bad out = "" out << "
    • #{user_content}
    • " out << "
    • #{user_content}
    • " out.html_safe # => ActiveSupport::SafeBuffer "
    • hi
    • hi
    • " # good out = [] out << content_tag(:li, user_content) out << content_tag(:li, user_content) safe_join(out) # => ActiveSupport::SafeBuffer # "
    • <b>hi</b>
    • <b>hi</b>
    • " # bad out = "

      trusted content

      ".html_safe out.safe_concat(user_content) # => ActiveSupport::SafeBuffer "

      trusted_content

      hi" # good out = "

      trusted content

      ".html_safe out.concat(user_content) # => ActiveSupport::SafeBuffer # "

      trusted_content

      <b>hi</b>" # safe, though maybe not good style out = "trusted content" result = out.concat(user_content) # => String "trusted contenthi" # because when rendered in ERB the String will be escaped: # <%= result %> # => trusted content<b>hi</b> # bad (user_content + " " + content_tag(:span, user_content)).html_safe # => ActiveSupport::SafeBuffer "hi <span><b>hi</b></span>" # good safe_join([user_content, " ", content_tag(:span, user_content)]) # => ActiveSupport::SafeBuffer # "<b>hi</b> <span>&lt;b&gt;hi&lt;/b&gt;</span>"

      Specify an :inverse_of option.
      Open

        has_many :scores, class_name: 'Answer', foreign_key: 'response_id', dependent: :destroy
      Severity: Minor
      Found in app/models/response.rb by rubocop

      This cop looks for has(one|many) and belongsto associations where ActiveRecord can't automatically determine the inverse association because of a scope or the options used. This can result in unnecessary queries in some circumstances. :inverse_of must be manually specified for associations to work in both ways, or set to false to opt-out.

      Example:

      # good
      class Blog < ApplicationRecord
        has_many :posts
      end
      
      class Post < ApplicationRecord
        belongs_to :blog
      end

      Example:

      # bad
      class Blog < ApplicationRecord
        has_many :posts, -> { order(published_at: :desc) }
      end
      
      class Post < ApplicationRecord
        belongs_to :blog
      end
      
      # good
      class Blog < ApplicationRecord
        has_many(:posts,
          -> { order(published_at: :desc) },
          inverse_of: :blog
        )
      end
      
      class Post < ApplicationRecord
        belongs_to :blog
      end
      
      # good
      class Blog < ApplicationRecord
        with_options inverse_of: :blog do
          has_many :posts, -> { order(published_at: :desc) }
        end
      end
      
      class Post < ApplicationRecord
        belongs_to :blog
      end

      Example:

      # bad
      class Picture < ApplicationRecord
        belongs_to :imageable, polymorphic: true
      end
      
      class Employee < ApplicationRecord
        has_many :pictures, as: :imageable
      end
      
      class Product < ApplicationRecord
        has_many :pictures, as: :imageable
      end
      
      # good
      class Picture < ApplicationRecord
        belongs_to :imageable, polymorphic: true
      end
      
      class Employee < ApplicationRecord
        has_many :pictures, as: :imageable, inverse_of: :imageable
      end
      
      class Product < ApplicationRecord
        has_many :pictures, as: :imageable, inverse_of: :imageable
      end

      Example:

      # bad
      # However, RuboCop can not detect this pattern...
      class Physician < ApplicationRecord
        has_many :appointments
        has_many :patients, through: :appointments
      end
      
      class Appointment < ApplicationRecord
        belongs_to :physician
        belongs_to :patient
      end
      
      class Patient < ApplicationRecord
        has_many :appointments
        has_many :physicians, through: :appointments
      end
      
      # good
      class Physician < ApplicationRecord
        has_many :appointments
        has_many :patients, through: :appointments
      end
      
      class Appointment < ApplicationRecord
        belongs_to :physician, inverse_of: :appointments
        belongs_to :patient, inverse_of: :appointments
      end
      
      class Patient < ApplicationRecord
        has_many :appointments
        has_many :physicians, through: :appointments
      end

      @see http://guides.rubyonrails.org/association_basics.html#bi-directional-associations @see http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#module-ActiveRecord::Associations::ClassMethods-label-Setting+Inverses

      Specify an :inverse_of option.
      Open

        belongs_to :response_map, class_name: 'ResponseMap', foreign_key: 'map_id'
      Severity: Minor
      Found in app/models/response.rb by rubocop

      This cop looks for has(one|many) and belongsto associations where ActiveRecord can't automatically determine the inverse association because of a scope or the options used. This can result in unnecessary queries in some circumstances. :inverse_of must be manually specified for associations to work in both ways, or set to false to opt-out.

      Example:

      # good
      class Blog < ApplicationRecord
        has_many :posts
      end
      
      class Post < ApplicationRecord
        belongs_to :blog
      end

      Example:

      # bad
      class Blog < ApplicationRecord
        has_many :posts, -> { order(published_at: :desc) }
      end
      
      class Post < ApplicationRecord
        belongs_to :blog
      end
      
      # good
      class Blog < ApplicationRecord
        has_many(:posts,
          -> { order(published_at: :desc) },
          inverse_of: :blog
        )
      end
      
      class Post < ApplicationRecord
        belongs_to :blog
      end
      
      # good
      class Blog < ApplicationRecord
        with_options inverse_of: :blog do
          has_many :posts, -> { order(published_at: :desc) }
        end
      end
      
      class Post < ApplicationRecord
        belongs_to :blog
      end

      Example:

      # bad
      class Picture < ApplicationRecord
        belongs_to :imageable, polymorphic: true
      end
      
      class Employee < ApplicationRecord
        has_many :pictures, as: :imageable
      end
      
      class Product < ApplicationRecord
        has_many :pictures, as: :imageable
      end
      
      # good
      class Picture < ApplicationRecord
        belongs_to :imageable, polymorphic: true
      end
      
      class Employee < ApplicationRecord
        has_many :pictures, as: :imageable, inverse_of: :imageable
      end
      
      class Product < ApplicationRecord
        has_many :pictures, as: :imageable, inverse_of: :imageable
      end

      Example:

      # bad
      # However, RuboCop can not detect this pattern...
      class Physician < ApplicationRecord
        has_many :appointments
        has_many :patients, through: :appointments
      end
      
      class Appointment < ApplicationRecord
        belongs_to :physician
        belongs_to :patient
      end
      
      class Patient < ApplicationRecord
        has_many :appointments
        has_many :physicians, through: :appointments
      end
      
      # good
      class Physician < ApplicationRecord
        has_many :appointments
        has_many :patients, through: :appointments
      end
      
      class Appointment < ApplicationRecord
        belongs_to :physician, inverse_of: :appointments
        belongs_to :patient, inverse_of: :appointments
      end
      
      class Patient < ApplicationRecord
        has_many :appointments
        has_many :physicians, through: :appointments
      end

      @see http://guides.rubyonrails.org/association_basics.html#bi-directional-associations @see http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#module-ActiveRecord::Associations::ClassMethods-label-Setting+Inverses

      TODO found
      Open

        # TODO: change metareview_response_map relationship to belongs_to
      Severity: Minor
      Found in app/models/response.rb by fixme

      Useless assignment to variable - code. Use + instead of +=.
      Open

          code += '</table>'
      Severity: Minor
      Found in app/models/response.rb by rubocop

      This cop checks for every useless assignment to local variable in every scope. The basic idea for this cop was from the warning of ruby -cw:

      assigned but unused variable - foo

      Currently this cop has advanced logic that detects unreferenced reassignments and properly handles varied cases such as branch, loop, rescue, ensure, etc.

      Example:

      # bad
      
      def some_method
        some_var = 1
        do_something
      end

      Example:

      # good
      
      def some_method
        some_var = 1
        do_something(some_var)
      end

      Missing space after #.
      Open

                        #Answer Tags are enabled only for Criterion questions at the moment.
      Severity: Minor
      Found in app/models/response.rb by rubocop

      This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

      Example:

      # bad
      #Some comment
      
      # good
      # Some comment

      Useless assignment to variable - identifier. Use + instead of +=.
      Open

          identifier += '<table width="100%">'\
      Severity: Minor
      Found in app/models/response.rb by rubocop

      This cop checks for every useless assignment to local variable in every scope. The basic idea for this cop was from the warning of ruby -cw:

      assigned but unused variable - foo

      Currently this cop has advanced logic that detects unreferenced reassignments and properly handles varied cases such as branch, loop, rescue, ensure, etc.

      Example:

      # bad
      
      def some_method
        some_var = 1
        do_something
      end

      Example:

      # good
      
      def some_method
        some_var = 1
        do_something(some_var)
      end

      Line is too long. [175/160]
      Open

          # only count the scorable questions, only when the answer is not nil (we accept nil as answer for scorable questions, and they will not be counted towards the total score)
      Severity: Minor
      Found in app/models/response.rb by rubocop

      Use count.zero? instead of count == 0.
      Open

          return false if count == 0
      Severity: Minor
      Found in app/models/response.rb by rubocop

      This cop checks for usage of comparison operators (==, >, <) to test numbers as zero, positive, or negative. These can be replaced by their respective predicate methods. The cop can also be configured to do the reverse.

      The cop disregards #nonzero? as it its value is truthy or falsey, but not true and false, and thus not always interchangeable with != 0.

      The cop ignores comparisons to global variables, since they are often populated with objects which can be compared with integers, but are not themselves Interger polymorphic.

      Example: EnforcedStyle: predicate (default)

      # bad
      
      foo == 0
      0 > foo
      bar.baz > 0
      
      # good
      
      foo.zero?
      foo.negative?
      bar.baz.positive?

      Example: EnforcedStyle: comparison

      # bad
      
      foo.zero?
      foo.negative?
      bar.baz.positive?
      
      # good
      
      foo == 0
      0 > foo
      bar.baz > 0

      Line is too long. [247/160]
      Open

            avg_vol_in_round = (Lingua::EN::Readability.new(instance_variable_get('@comments_in_round' + i.to_s)).num_words / (instance_variable_get('@counter_in_round' + i.to_s).zero? ? 1 : instance_variable_get('@counter_in_round' + i.to_s))).round(0)
      Severity: Minor
      Found in app/models/response.rb by rubocop

      There are no issues that match your filters.

      Category
      Status