ece517-p3/expertiza

View on GitHub
spec/models/assignment_particpant_spec.rb

Summary

Maintainability
B
4 hrs
Test Coverage

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

describe AssignmentParticipant do
  let(:response) { build(:response) }
  let(:team) { build(:assignment_team, id: 1) }
  let(:team2) { build(:assignment_team, id: 2) }
  let(:response_map) { build(:review_response_map, reviewer_id: 2, response: [response]) }

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 assignment_particpant_spec.rb has 371 lines of code (exceeds 250 allowed). Consider refactoring.
Open

describe AssignmentParticipant do
  let(:response) { build(:response) }
  let(:team) { build(:assignment_team, id: 1) }
  let(:team2) { build(:assignment_team, id: 2) }
  let(:response_map) { build(:review_response_map, reviewer_id: 2, response: [response]) }
Severity: Minor
Found in spec/models/assignment_particpant_spec.rb - About 4 hrs to fix

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

      describe '#scores' do
        before(:each) do
          allow(AssignmentQuestionnaire).to receive(:find_by).with(assignment_id: 1, questionnaire_id: 1)
                                                             .and_return(double('AssignmentQuestionnaire', used_in_round: 1))
          allow(review_questionnaire).to receive(:symbol).and_return(:review)

    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. [41/25]
    Open

      describe ".import" do
        context 'when record is empty' do
          it 'raises an ArgumentError' do
            expect { AssignmentParticipant.import({}, nil, nil, nil) }.to raise_error(ArgumentError, 'No user id has been specified.')
          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. [34/25]
    Open

        context 'when no user is found by offered username' do
          context 'when the record has less than 4 items' do
            it 'raises an ArgumentError' do
              row = {name: 'no one', fullname: 'no one', email: 'no_one@email.com'}
              expect { AssignmentParticipant.import(row, nil, nil, nil) }.to raise_error('The record containing no one does not have enough items.')

    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. [32/25]
    Open

      describe '#compute_assignment_score' do
        before(:each) do
          allow(review_questionnaire).to receive(:symbol).and_return(:review)
          allow(assignment).to receive(:compute_total_score).with(any_args).and_return(100)
        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. [26/25]
    Open

          context 'when the record has more than 4 items' do
            let(:row) do
              {name: 'no one', fullname: 'no one', email: 'name@email.com', role:'user_role_name', parent: 'user_parent_name'}
            end
            let(:attributes) do

    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. [26/25]
    Open

      describe '#stage_deadline' do
        context 'when stage of current assignment is not Finished' do
          it 'returns current stage' do
            allow(SignedUpTeam).to receive(:topic_id).with(1, 2).and_return(5)
            allow(assignment).to receive(:stage_deadline).with(5).and_return('submission')

    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.

    Interpolation in single quoted string detected. Use double quoted strings if you need interpolation.
    Open

          it 'record the result as review#{n} scores' do

    This cop checks for interpolation in a single quoted string.

    Example:

    # bad
    
    foo = 'something with #{interpolation} inside'

    Example:

    # good
    
    foo = "something with #{interpolation} inside"

    Space missing after colon.
    Open

              {name: 'no one', fullname: 'no one', email: 'name@email.com', role:'user_role_name', parent: 'user_parent_name'}

    Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

    Example:

    # bad
    def f(a:, b:2); {a:3}; end
    
    # good
    def f(a:, b: 2); {a: 3}; end

    There are no issues that match your filters.

    Category
    Status