expertiza/expertiza

View on GitHub
spec/features/assignment_creation_spec.rb

Summary

Maintainability
D
2 days
Test Coverage

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

describe "assignment function" do
  before(:each) do
    create(:deadline_type, name: "submission")
    create(:deadline_type, name: "review")
    create(:deadline_type, name: "metareview")

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

  describe "creation page", js: true do
    before(:each) do
      (1..3).each do |i|
        create(:course, name: "Course #{i}")
      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.

File assignment_creation_spec.rb has 633 lines of code (exceeds 250 allowed). Consider refactoring.
Open

def questionnaire_options(assignment, type, _round = 0)
  questionnaires = Questionnaire.where(['private = 0 or instructor_id = ?', assignment.instructor_id]).order('name')
  options = []
  questionnaires.select {|x| x.type == type }.each do |questionnaire|
    options << [questionnaire.name, questionnaire.id]
Severity: Major
Found in spec/features/assignment_creation_spec.rb - About 1 day to fix

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

      describe "topics tab", js: true do
        before(:each) do
          (1..3).each do |i|
            create(:course, name: "Course #{i}")
          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. [75/25]
    Open

      describe "general tab", js: true do
        before(:each) do
          (1..3).each do |i|
            create(:course, name: "Course #{i}")
          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. [71/25]
    Open

      describe "rubrics tab", js: true do
        before(:each) do
          @assignment = create(:assignment)
          create_list(:participant, 3)
          # Create an assignment due date

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

        describe "Edit review rubric" do
          it "updates review questionnaire" do
            within(:css, "tr#questionnaire_table_ReviewQuestionnaire") do
              select "ReviewQuestionnaire2", from: 'assignment_form[assignment_questionnaire][][questionnaire_id]'
              uncheck('dropdown')

    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 "Due dates tab", js: true do
        before(:each) do
          @assignment = create(:assignment, name: 'public assignment for test')
          login_as("instructor6")
          visit "/assignments/#{@assignment.id}/edit"

    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 "review strategy tab", js: true do
        before(:each) do
          create(:assignment, name: 'public assignment for test')
          @assignment_id = Assignment.where(name: 'public assignment for test').first.id
        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

      describe "deadlines", js: true do
        before(:each) do
          @assignment = create(:assignment, name: 'public assignment for test')
          login_as("instructor6")
          visit "/assignments/#{@assignment.id}/edit"

    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.

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        it "is able to create with quiz" do
          login_as("instructor6")
          visit '/assignments/new?private=1'
    
          fill_in 'assignment_form_assignment_name', with: 'private assignment for test'
    Severity: Major
    Found in spec/features/assignment_creation_spec.rb and 1 other location - About 1 hr to fix
    spec/features/assignment_creation_spec.rb on lines 107..124

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 50.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        it "is able to create with teams" do
          login_as("instructor6")
          visit '/assignments/new?private=1'
    
          fill_in 'assignment_form_assignment_name', with: 'private assignment for test'
    Severity: Major
    Found in spec/features/assignment_creation_spec.rb and 1 other location - About 1 hr to fix
    spec/features/assignment_creation_spec.rb on lines 127..143

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 50.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        it "is able to create calibrated public assignment" do
          login_as("instructor6")
          visit '/assignments/new?private=0'
    
          fill_in 'assignment_form_assignment_name', with: 'public assignment for test'
    Severity: Minor
    Found in spec/features/assignment_creation_spec.rb and 1 other location - About 45 mins to fix
    spec/features/assignment_creation_spec.rb on lines 192..205

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 41.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        it "is able to create public micro-task assignment" do
          login_as("instructor6")
          visit '/assignments/new?private=0'
    
          fill_in 'assignment_form_assignment_name', with: 'public assignment for test'
    Severity: Minor
    Found in spec/features/assignment_creation_spec.rb and 1 other location - About 45 mins to fix
    spec/features/assignment_creation_spec.rb on lines 207..220

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 41.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    def questionnaire_options(assignment, type, _round = 0)
      questionnaires = Questionnaire.where(['private = 0 or instructor_id = ?', assignment.instructor_id]).order('name')
      options = []
      questionnaires.select {|x| x.type == type }.each do |questionnaire|
        options << [questionnaire.name, questionnaire.id]
    Severity: Minor
    Found in spec/features/assignment_creation_spec.rb and 1 other location - About 35 mins to fix
    app/helpers/assignment_helper.rb on lines 33..39

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 34.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        it "is able show tab rubrics" do
          login_as("instructor6")
          visit '/assignments/new?private=0'
          fill_in 'assignment_form_assignment_name', with: 'public assignment for test'
          select('Course 2', from: 'assignment_form_assignment_course_id')
    Severity: Minor
    Found in spec/features/assignment_creation_spec.rb and 3 other locations - About 25 mins to fix
    spec/features/assignment_creation_spec.rb on lines 222..230
    spec/features/assignment_creation_spec.rb on lines 233..241
    spec/features/assignment_creation_spec.rb on lines 283..291

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 31.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        it "is able show tab due deadlines" do
          login_as("instructor6")
          visit '/assignments/new?private=0'
          fill_in 'assignment_form_assignment_name', with: 'public assignment for test'
          select('Course 2', from: 'assignment_form_assignment_course_id')
    Severity: Minor
    Found in spec/features/assignment_creation_spec.rb and 3 other locations - About 25 mins to fix
    spec/features/assignment_creation_spec.rb on lines 222..230
    spec/features/assignment_creation_spec.rb on lines 272..280
    spec/features/assignment_creation_spec.rb on lines 283..291

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 31.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        it "is able show tab review strategy" do
          login_as("instructor6")
          visit '/assignments/new?private=0'
          fill_in 'assignment_form_assignment_name', with: 'public assignment for test'
          select('Course 2', from: 'assignment_form_assignment_course_id')
    Severity: Minor
    Found in spec/features/assignment_creation_spec.rb and 3 other locations - About 25 mins to fix
    spec/features/assignment_creation_spec.rb on lines 233..241
    spec/features/assignment_creation_spec.rb on lines 272..280
    spec/features/assignment_creation_spec.rb on lines 283..291

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 31.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        it "is able show attributes in rubrics" do
          login_as("instructor6")
          visit '/assignments/new?private=0'
          fill_in 'assignment_form_assignment_name', with: 'public assignment for test'
          select('Course 2', from: 'assignment_form_assignment_course_id')
    Severity: Minor
    Found in spec/features/assignment_creation_spec.rb and 3 other locations - About 25 mins to fix
    spec/features/assignment_creation_spec.rb on lines 222..230
    spec/features/assignment_creation_spec.rb on lines 233..241
    spec/features/assignment_creation_spec.rb on lines 272..280

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 31.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Final newline missing.
    Open

    end

    Trailing whitespace detected.
    Open

      

    Line is too long. [177/160]
    Open

          pending(%(not sure what's broken here but the error is: #ActionController::RoutingError: No route matches [GET] "/assets/staggered_deadline_assignment_graph/graph_1.jpg"))

    Prefer Date or Time over DateTime.
    Open

          create :assignment_due_date, due_at: (DateTime.now.in_time_zone + 1), deadline_type: @review_deadline_type

    This cop checks for uses of DateTime that should be replaced by Date or Time.

    Example:

    # bad - uses `DateTime` for current time
    DateTime.now
    
    # good - uses `Time` for current time
    Time.now
    
    # bad - uses `DateTime` for modern date
    DateTime.iso8601('2016-06-29')
    
    # good - uses `Date` for modern date
    Date.iso8601('2016-06-29')
    
    # good - uses `DateTime` with start argument for historical date
    DateTime.iso8601('1751-04-23', Date::ENGLAND)

    Prefer Date or Time over DateTime.
    Open

          create :assignment_due_date, due_at: (DateTime.now.in_time_zone - 1)

    This cop checks for uses of DateTime that should be replaced by Date or Time.

    Example:

    # bad - uses `DateTime` for current time
    DateTime.now
    
    # good - uses `Time` for current time
    Time.now
    
    # bad - uses `DateTime` for modern date
    DateTime.iso8601('2016-06-29')
    
    # good - uses `Date` for modern date
    Date.iso8601('2016-06-29')
    
    # good - uses `DateTime` with start argument for historical date
    DateTime.iso8601('1751-04-23', Date::ENGLAND)

    Do not use semicolons to terminate expressions.
    Open

          expect { click_button 'Add', match: :first; sleep(1) }.to change { Participant.count }.by 1

    This cop checks for multiple expressions placed on the same line. It also checks for lines terminated with a semicolon.

    Example:

    # bad
    foo = 1; bar = 2;
    baz = 3;
    
    # good
    foo = 1
    bar = 2
    baz = 3

    There are no issues that match your filters.

    Category
    Status