expertiza/expertiza

View on GitHub
spec/controllers/review_mapping_controller_spec.rb

Summary

Maintainability
C
1 day
Test Coverage

Block has too many lines. [622/25]
Open

describe ReviewMappingController do
  let(:assignment) { double('Assignment', id: 1) }
  let(:reviewer) { double('Participant', id: 1, name: 'reviewer') }
  let(:review_response_map) do
    double('ReviewResponseMap', id: 1, map_id: 1, assignment: assignment,

This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

File review_mapping_controller_spec.rb has 625 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'rails_helper'
describe ReviewMappingController do
  let(:assignment) { double('Assignment', id: 1) }
  let(:reviewer) { double('Participant', id: 1, name: 'reviewer') }
  let(:review_response_map) do
Severity: Major
Found in spec/controllers/review_mapping_controller_spec.rb - About 1 day to fix

    Block has too many lines. [131/25]
    Open

      describe '#assign_reviewer_dynamically' do
        before(:each) do
          allow(AssignmentParticipant).to receive_message_chain(:where, :first)
            .with(user_id: '1', parent_id: 1).with(no_args).and_return(participant)
        end

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Block has too many lines. [100/25]
    Open

      describe '#automatic_review_mapping' do
        before(:each) do
          allow(AssignmentParticipant).to receive(:where).with(parent_id: 1).and_return([participant, participant1, participant2])
        end
    
    

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Block has too many lines. [74/25]
    Open

        context 'when teams is not empty' do
          before(:each) do
            allow(AssignmentTeam).to receive(:where).with(parent_id: 1).and_return([team, team1])
          end
    
    

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Block has too many lines. [39/25]
    Open

      describe '#add_reviewer and #get_reviewer' do
        before(:each) do
          allow(User).to receive_message_chain(:where, :first).with(name: 'expertiza').with(no_args).and_return(double('User', id: 1))
          @params = {
            id: 1,

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Block has too many lines. [33/25]
    Open

      describe '#delete_outstanding_reviewers' do
        before(:each) do
          allow(AssignmentTeam).to receive(:find).with('1').and_return(team)
          allow(team).to receive(:review_mappings).and_return([double('ReviewResponseMap', id: 1)])
        end

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Block has too many lines. [31/25]
    Open

      describe '#delete_all_metareviewers' do
        before(:each) do
          allow(ResponseMap).to receive(:find).with('1').and_return(review_response_map)
          @metareview_response_maps = [metareview_response_map]
          allow(MetareviewResponseMap).to receive(:where).with(reviewed_object_id: 1).and_return(@metareview_response_maps)

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Block has too many lines. [30/25]
    Open

      describe '#assign_quiz_dynamically' do
        before(:each) do
          allow(AssignmentParticipant).to receive_message_chain(:where, :first)
            .with(user_id: '1', parent_id: 1).with(no_args).and_return(participant)
          @params = {

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Block has too many lines. [28/25]
    Open

      describe '#start_self_review' do
        before(:each) do
          allow(Team).to receive(:find_team_for_assignment_and_user).with(1, '1').and_return([double('Team', id: 1)])
        end
    
    

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Block has too many lines. [28/25]
    Open

      describe '#add_calibration' do
        context 'when both participant and review_response_map have already existed' do
          it 'does not need to create new objects and redirects to responses#new maps' do
            allow(AssignmentParticipant).to receive_message_chain(:where, :first)
              .with(parent_id: '1', user_id: 1).with(no_args).and_return(participant)

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Space inside { missing.
    Open

          session_params = {user: stub_current_user(instructor, instructor.role.name, instructor.role) }

    Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

    Example: EnforcedStyle: space

    # The `space` style enforces that hash literals have
    # surrounding space.
    
    # bad
    h = {a: 1, b: 2}
    
    # good
    h = { a: 1, b: 2 }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that hash literals have
    # no surrounding space.
    
    # bad
    h = { a: 1, b: 2 }
    
    # good
    h = {a: 1, b: 2}

    Example: EnforcedStyle: compact

    # The `compact` style normally requires a space inside
    # hash braces, with the exception that successive left
    # braces or right braces are collapsed together in nested hashes.
    
    # bad
    h = { a: { b: 2 } }
    
    # good
    h = { a: { b: 2 }}

    Trailing whitespace detected.
    Open

            assignment_double = double('Assignment', auto_assign_mentor: false) 

    Useless assignment to variable - params.
    Open

            params = { id: 1 }

    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

    Useless assignment to variable - params.
    Open

            params = { id: 1 }

    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

    There are no issues that match your filters.

    Category
    Status