pupilfirst/pupilfirst

View on GitHub

Showing 122 of 226 total issues

File rollbar.js has 430 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var _rollbarConfig = {
  accessToken: window.pupilfirst.rollbar.accessToken,
  captureUncaught: window.pupilfirst.rollbar.captureUncaught,
  captureUnhandledRejections:
    window.pupilfirst.rollbar.captureUnhandledRejections,
Severity: Minor
Found in app/frontend/shared/utils/rollbar.js - About 6 hrs to fix

    Class AppRouterPresenter has 29 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class AppRouterPresenter < ::ApplicationPresenter
        def initialize(view_context, course)
          @course = course
          super(view_context)
        end
    Severity: Minor
    Found in app/presenters/layouts/app_router_presenter.rb - About 3 hrs to fix

      Function audioRecorder has 80 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function audioRecorder(authenticity_token, attachingCB) {
        const [state, setState] = useState({
          recording: false,
          url: undefined,
          blob: undefined,

        File details_service.rb has 297 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module Targets
          class DetailsService
            include RoutesResolvable
        
            def initialize(target, student, public_preview:)
        Severity: Minor
        Found in app/services/targets/details_service.rb - About 3 hrs to fix

          Class StudentPresenter has 25 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class StudentPresenter < ApplicationPresenter
              def initialize(view_context, student)
                @student = student
                super(view_context)
              end
          Severity: Minor
          Found in app/presenters/organisations/student_presenter.rb - About 2 hrs to fix

            Class ApplicationController has 24 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class ApplicationController < ActionController::Base
              include Pundit::Authorization
            
              # Prevent CSRF attacks by raising an exception. Note that this is different from the default of :null_session.
              # Rails 5 introduced a boolean option called prepend for maintaining the order of execution
            Severity: Minor
            Found in app/controllers/application_controller.rb - About 2 hrs to fix

              Class CurriculumPresenter has 24 methods (exceeds 20 allowed). Consider refactoring.
              Open

                class CurriculumPresenter < ApplicationPresenter
                  def initialize(view_context, course)
                    @course = course
                    super(view_context)
                  end
              Severity: Minor
              Found in app/presenters/courses/curriculum_presenter.rb - About 2 hrs to fix

                Consider simplifying this complex logical expression.
                Open

                        if (r) {
                          var o = e.globalAlias || "Rollbar";
                          if ("object" == typeof r[o]) return r[o];
                          (r._rollbarShims = {}), (r._rollbarWrappedError = null);
                          var l = new c(e);
                Severity: Critical
                Found in app/frontend/shared/utils/rollbar.js - About 2 hrs to fix

                  Class LeaderboardPresenter has 24 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                    class LeaderboardPresenter < ApplicationPresenter
                      class Student < SimpleDelegator
                        attr_reader :score, :rank
                        attr_accessor :delta
                  
                  
                  Severity: Minor
                  Found in app/presenters/courses/leaderboard_presenter.rb - About 2 hrs to fix

                    File curriculum_presenter.rb has 271 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    module Courses
                      class CurriculumPresenter < ApplicationPresenter
                        def initialize(view_context, course)
                          @course = course
                          super(view_context)
                    Severity: Minor
                    Found in app/presenters/courses/curriculum_presenter.rb - About 2 hrs to fix

                      Method filter has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def filter
                            @filter ||=
                              begin
                                milestone_targets_data =
                                  milestone_targets
                      Severity: Major
                      Found in app/presenters/cohorts/students_presenter.rb - About 2 hrs to fix

                        Class SubmissionDetailsResolver has 22 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        class SubmissionDetailsResolver < ApplicationQuery
                          property :submission_id
                        
                          def submission_details
                            {
                        Severity: Minor
                        Found in app/queries/submission_details_resolver.rb - About 2 hrs to fix

                          Class Target has 21 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                          class Target < ApplicationRecord
                            # Use to allow changing visibility of a target. See Targets::UpdateVisibilityService.
                            attr_accessor :safe_to_change_visibility
                          
                            STATUS_COMPLETE = :complete
                          Severity: Minor
                          Found in app/models/target.rb - About 2 hrs to fix

                            Class User has 21 methods (exceeds 20 allowed). Consider refactoring.
                            Open

                            class User < ApplicationRecord
                              acts_as_taggable
                            
                              belongs_to :school
                              belongs_to :organisation, optional: true
                            Severity: Minor
                            Found in app/models/user.rb - About 2 hrs to fix

                              Method auth_callback has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  def auth_callback
                                    begin
                                      crypt = EncryptorService.new
                              
                                      data =
                              Severity: Major
                              Found in app/controllers/users/sessions_controller.rb - About 2 hrs to fix

                                Method students has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  def students
                                    scope = course.students
                                
                                    scope =
                                      if current_school_admin.present? &&
                                Severity: Minor
                                Found in app/queries/course_students_resolver.rb - About 2 hrs to fix

                                  Method students has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    def students
                                      scope = course.students
                                  
                                      scope =
                                        if current_school_admin.present? &&
                                  Severity: Minor
                                  Found in app/queries/course_students_resolver.rb - About 1 hr to fix

                                  Cognitive Complexity

                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                  A method's cognitive complexity is based on a few simple rules:

                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                  • Code is considered more complex for each "break in the linear flow of the code"
                                  • Code is considered more complex when "flow breaking structures are nested"

                                  Further reading

                                  Method comments_for_submissions has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      def comments_for_submissions
                                        #TODO - clean up this code using the list of attributes
                                        reaction_attributes = [
                                          :id,
                                          :user_id,
                                  Severity: Minor
                                  Found in app/services/targets/details_service.rb - About 1 hr to fix

                                    Method details has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        def details
                                          details = default_props
                                          if @student.present?
                                            details =
                                              details.update(
                                    Severity: Minor
                                    Found in app/services/targets/details_service.rb - About 1 hr to fix

                                      Function notify has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      const notify = (title, text, type) => {
                                        let notificationText = text;
                                        let textTrusted = false;
                                        let reloadRequired = false;
                                      
                                      
                                      Severity: Minor
                                      Found in app/frontend/shared/notifier.js - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language