epicodus/epicenter

View on GitHub

Showing 299 of 299 total issues

File student_spec.rb has 1688 lines of code (exceeds 250 allowed). Consider refactoring.
Open

describe Student do
it { should have_many :bank_accounts }
it { should have_many :payment_methods }
it { should have_many :credit_cards }
it { should have_many :payments }
Severity: Major
Found in spec_old/models/student_spec.rb - About 4 days to fix

    File course_spec.rb has 716 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    describe Course do
    it { should belong_to(:admin).optional }
    it { should belong_to :office }
    it { should belong_to :language }
    it { should belong_to(:cohort) }
    Severity: Major
    Found in spec_old/models/course_spec.rb - About 1 day to fix

      Class Student has 86 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class Student < User
      scope :with_activated_accounts, -> { where('sign_in_count > ?', 0 ) }
       
      validate :primary_payment_method_belongs_to_student
       
       
      Severity: Major
      Found in app/models/student.rb - About 1 day to fix

        File payments_pages_spec.rb has 671 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        feature 'Viewing payment index page' do
        scenario 'as a guest' do
        student = FactoryBot.create(:student)
        visit student_payments_path(student)
        expect(page).to have_content 'need to sign in'
        Severity: Major
        Found in spec_old/features/payments_pages_spec.rb - About 1 day to fix

          File admin_pages_spec.rb has 670 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          feature 'Admin signs in' do
          let(:admin) { FactoryBot.create(:admin, :with_course) }
          let(:admin_with_2fa) { FactoryBot.create(:admin, :with_course, :with_2fa) }
           
          after { OmniAuth.config.mock_auth[:github] = nil }
          Severity: Major
          Found in spec_old/features/admin_pages_spec.rb - About 1 day to fix

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

            describe 'CodeReviewsPages' do
            let(:course) { FactoryBot.create(:course) }
            let(:student) { FactoryBot.create(:student, :with_all_documents_signed, course: course) }
            let(:admin) { FactoryBot.create(:admin, courses: [student.course]) }
            let!(:code_review) { FactoryBot.create(:code_review, course: student.course, journal: journal) }
            Severity: Major
            Found in spec_old/features/code_reviews_pages_spec.rb - About 1 day to fix

              File students_pages_spec.rb has 508 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              feature 'Guest attempts to sign up' do
              scenario 'without an invitation' do
              visit new_student_registration_path
              expect(page).to have_content 'Sign up is only allowed via invitation.'
              end
              Severity: Major
              Found in spec_old/features/students_pages_spec.rb - About 1 day to fix

                File student.rb has 475 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                class Student < User
                scope :with_activated_accounts, -> { where('sign_in_count > ?', 0 ) }
                 
                validate :primary_payment_method_belongs_to_student
                 
                 
                Severity: Minor
                Found in app/models/student.rb - About 7 hrs to fix

                  Class Course has 48 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Course < ApplicationRecord
                  default_scope { order(:start_date) }
                   
                  scope :fulltime_courses, -> { where(parttime: false) }
                  scope :parttime_intro_courses, -> { joins(:track).where("tracks.description IN (?)", ['Part-Time Intro to Programming', 'Part-Time Evening Intro to Programming']) }
                  Severity: Minor
                  Found in app/models/course.rb - About 6 hrs to fix

                    File payment_spec.rb has 359 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    describe Payment do
                    include ActionView::Helpers::NumberHelper #for number_to_currency
                     
                    it { should belong_to :student }
                    it { should belong_to(:cohort).optional }
                    Severity: Minor
                    Found in spec_old/models/payment_spec.rb - About 4 hrs to fix

                      Method update_student_as_admin has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def update_student_as_admin
                      @student = Student.find(params[:id])
                      if @student.update(student_params)
                      if student_params[:cohort_id]
                      redirect_to student_courses_path(@student), notice: "Current cohort for #{@student.name} has been set to #{@student.cohort.try(:description) || 'blank'}."
                      Severity: Minor
                      Found in app/controllers/students_controller.rb - About 4 hrs to fix

                      File attendance_record_spec.rb has 326 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      describe AttendanceRecord do
                       
                      describe 'default scope' do
                      it 'orders by date ascending' do
                      student = FactoryBot.create(:student, :with_course)
                      Severity: Minor
                      Found in spec_old/models/attendance_record_spec.rb - About 3 hrs to fix

                        File enrollment_spec.rb has 322 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        describe Enrollment do
                         
                        it { should validate_presence_of :course }
                        it { should validate_presence_of :student }
                         
                         
                        Severity: Minor
                        Found in spec_old/models/enrollment_spec.rb - About 3 hrs to fix

                          Class CrmLead has 30 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                          class CrmLead
                          def initialize(email)
                          @email = email
                          end
                           
                           
                          Severity: Minor
                          Found in app/models/crm_lead.rb - About 3 hrs to fix

                            File code_review_spec.rb has 311 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            describe CodeReview do
                            it { should validate_presence_of :title }
                            it { should validate_presence_of :course }
                            it { should have_many :objectives }
                            it { should have_many :submissions }
                            Severity: Minor
                            Found in spec_old/models/code_review_spec.rb - About 3 hrs to fix

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

                              $('#student_probation_teacher').change(function() {
                              var prompt = this.checked ? 'Are you sure you want to put this student on Academic Warning (TEACHER)?' : 'Remove student from Academic Warning (TEACHER)?'
                              var confirmed = confirm(prompt);
                              if (confirmed) {
                              this.form.submit();
                              Severity: Major
                              Found in app/assets/javascripts/probation.js and 1 other location - About 3 hrs to fix
                              app/assets/javascripts/probation.js on lines 12..20

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

                              $('#student_probation_advisor').change(function() {
                              var prompt = this.checked ? 'Are you sure you want to put this student on Academic Warning (ADVISOR)?' : 'Remove student from Academic Warning (ADVISOR)?'
                              var confirmed = confirm(prompt);
                              if (confirmed) {
                              this.form.submit();
                              Severity: Major
                              Found in app/assets/javascripts/probation.js and 1 other location - About 3 hrs to fix
                              app/assets/javascripts/probation.js on lines 2..10

                              File internship_pages_spec.rb has 302 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              feature 'viewing the internships index page' do
                              context 'as a student' do
                              let(:student) { FactoryBot.create(:student, :with_course, :with_all_documents_signed) }
                              let!(:internship) { FactoryBot.create(:internship, courses: [student.course]) }
                              before { login_as(student, scope: :student) }
                              Severity: Minor
                              Found in spec_old/features/internship_pages_spec.rb - About 3 hrs to fix

                                File attendance_pages_spec.rb has 295 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                feature "attendance sign in and out", :stub_mailgun do
                                let(:student) { FactoryBot.create(:portland_student, :with_all_documents_signed) }
                                let(:course_start) { student.course.start_time_on_day(student.course.start_date) }
                                 
                                before { login_as(student, scope: :student) }
                                Severity: Minor
                                Found in spec_old/features/attendance_pages_spec.rb - About 3 hrs to fix

                                  File submission_pages_spec.rb has 287 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  feature 'Visiting the submissions index page' do
                                  let(:student) { FactoryBot.create(:student, :with_course, :with_all_documents_signed) }
                                  let(:code_review) { FactoryBot.create(:code_review, course: student.course) }
                                   
                                  context 'as a student' do
                                  Severity: Minor
                                  Found in spec_old/features/submission_pages_spec.rb - About 2 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language