ece517-p3/expertiza

View on GitHub
spec/controllers/assignments_controller_spec.rb

Summary

Maintainability
A
4 hrs
Test Coverage

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

describe AssignmentsController do
  let(:assignment) do
    build(:assignment, id: 1, name: 'test assignment', instructor_id: 6, staggered_deadline: true, directory_path: 'same path',
                       participants: [build(:participant)], teams: [build(:assignment_team)], course_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. [87/25]
Open

  describe '#update' do
    context 'when params does not have key :assignment_form' do
      context 'when assignment is saved successfully' do
        it 'shows a note flash message and redirects to tree_display#index page' do
          allow(assignment).to receive(:save).and_return(true)

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

describe AssignmentsController do
  let(:assignment) do
    build(:assignment, id: 1, name: 'test assignment', instructor_id: 6, staggered_deadline: true, directory_path: 'same path',
                       participants: [build(:participant)], teams: [build(:assignment_team)], course_id: 1)
  end
Severity: Minor
Found in spec/controllers/assignments_controller_spec.rb - About 4 hrs to fix

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

      describe '#action_allowed?' do
        context 'when params action is edit or update' do
          before(:each) do
            controller.params = {id: '1', action: 'edit'}
          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. [57/25]
    Open

        context 'when params has key :assignment_form' do
          before(:each) do
            assignment_questionnaire = double('AssignmentQuestionnaire')
            allow(AssignmentQuestionnaire).to receive(:new).with(any_args).and_return(assignment_questionnaire)
            allow(assignment_questionnaire).to receive(:save).and_return(true)

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

      describe '#create' do
        before(:each) do
          allow(AssignmentForm).to receive(:new).with(any_args).and_return(assignment_form)
          @params = {
            button: '',

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

        context 'when params action is edit or update' do
          before(:each) do
            controller.params = {id: '1', action: 'edit'}
          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 '#copy' do
        let(:new_assignment) { build(:assignment, id: 2, name: 'new assignment', directory_path: 'different path') }
        let(:new_assignment2) { build(:assignment, id: 2, name: 'new assignment', directory_path: 'same path') }
    
        context 'when new assignment id fetches successfully' 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. [34/25]
    Open

          before(:each) do
            assignment_questionnaire = double('AssignmentQuestionnaire')
            allow(AssignmentQuestionnaire).to receive(:new).with(any_args).and_return(assignment_questionnaire)
            allow(assignment_questionnaire).to receive(:save).and_return(true)
            @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. [32/25]
    Open

      describe '#delete' do
        context 'when assignment is deleted successfully' do
          it 'shows a success flash message and redirects to tree_display#list page' do
            assignment_form = AssignmentForm.new
            allow(AssignmentForm).to receive(:new).and_return(assignment_form)

    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

        before(:each) do
          allow(AssignmentForm).to receive(:new).with(any_args).and_return(assignment_form)
          @params = {
            button: '',
            assignment_form: {

    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 params does not have key :assignment_form' do
          context 'when assignment is saved successfully' do
            it 'shows a note flash message and redirects to tree_display#index page' do
              allow(assignment).to receive(:save).and_return(true)
              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.

    Line is too long. [284/160]
    Open

                         {"id" => "", "parent_id" => "", "round" => "1", "deadline_type_id" => "2", "due_at" => "2017/12/02 00:00", "submission_allowed_id" => "1", "review_allowed_id" => "3", "teammate_review_allowed_id" => "3", "review_of_review_allowed_id" => "1", "threshold" => "1"}],

    Align .and_return with .with on line 158.
    Open

              .and_return([double('AssignmentQuestionnaire', questionnaire_id: 666, used_in_round: 1)])

    This cop checks the indentation of the method name part in method calls that span more than one line.

    Example: EnforcedStyle: aligned

    # bad
    while myvariable
    .b
      # do something
    end
    
    # good
    while myvariable
          .b
      # do something
    end
    
    # good
    Thing.a
         .b
         .c

    Example: EnforcedStyle: indented

    # good
    while myvariable
      .b
    
      # do something
    end

    Example: EnforcedStyle: indentedrelativeto_receiver

    # good
    while myvariable
            .a
            .b
    
      # do something
    end
    
    # good
    myvariable = Thing
                   .a
                   .b
                   .c

    Line is too long. [283/160]
    Open

              due_date: [{"id" => "", "parent_id" => "", "round" => "1", "deadline_type_id" => "1", "due_at" => "2017/12/05 00:00", "submission_allowed_id" => "3", "review_allowed_id" => "1", "teammate_review_allowed_id" => "3", "review_of_review_allowed_id" => "1", "threshold" => "1"},

    There are no issues that match your filters.

    Category
    Status