autolab/Autolab

View on GitHub

Showing 419 of 572 total issues

Method gradebook_columns has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def gradebook_columns(matrix, course)
    # user info columns
    columns = [
      { id: "number", name: "#", field: "", width: 50 },
      { id: "email", name: "Email", field: "email",
Severity: Minor
Found in app/helpers/gradebook_helper.rb - About 1 hr to fix

    Function handleScroll has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function handleScroll() {
          scrollTop = $viewport[0].scrollTop;
          scrollLeft = $viewport[0].scrollLeft;
          var vScrollDist = Math.abs(scrollTop - prevScrollTop);
          var hScrollDist = Math.abs(scrollLeft - prevScrollLeft);
    Severity: Minor
    Found in app/assets/javascripts/SlickGrid/2.02/slick.grid.js - About 1 hr to fix

      Function comparator has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  var comparator = function(nodeA, nodeB) {
                      var a = $.trim($(nodeA).text()).toLowerCase();
                      var b = $.trim($(nodeB).text()).toLowerCase();
                      var result;
      
      
      Severity: Minor
      Found in app/assets/javascripts/sorttable.js - About 1 hr to fix

        Method leave has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def leave
            if !@assessment.allow_student_assign_group && @cud.student?
              flash[:error] = "You are not allowed to change your group for this assessment. "\
                "Contact your instructor for group assignment."
              redirect_to(action: :index) && return
        Severity: Minor
        Found in app/controllers/groups_controller.rb - About 1 hr to fix

          Method save_entries has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def save_entries(entries, data_type)
              asmt = @assessment
          
              begin
                User.transaction do
          Severity: Minor
          Found in app/controllers/assessment/grading.rb - About 1 hr to fix

            Function enableSubmit has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

            function enableSubmit() {
              var checkbox = document.getElementById("integrity_checkbox");
              var tab = $(".submission-panel .ui.tab.active").attr('id');
              var fileSelector = $("#handin_show_assessment input[type='file']").get(0);
              if (tab === "github_tab") {
            Severity: Minor
            Found in app/assets/javascripts/handin.js - 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 extend_config_module has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

              def extend_config_module(assessment, submission, cud)
                # autograde core calls might be called before migration to unique module name occurs, so need to add check
                begin
                  if @assessment.use_unique_module_name
                    require assessment.unique_config_file_path
            Severity: Minor
            Found in app/helpers/assessment_autograde_core.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 import has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

              def import
                ass = @course.assessments.find(params[:ass])
                if !ass
                  flash[:error] = "Assessment not found."
                  redirect_to(action: :index) && return
            Severity: Minor
            Found in app/controllers/groups_controller.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

            Function WorkerTransport has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function WorkerTransport(workerInitializedCapability, pdfDataRangeTransport) {
                this.pdfDataRangeTransport = pdfDataRangeTransport;
                this.workerInitializedCapability = workerInitializedCapability;
                this.commonObjs = new PDFObjects();
            
            
            Severity: Minor
            Found in app/assets/javascripts/pdf.js - About 1 hr to fix

              Function showFiles has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function showFiles() {
                var fileSelector = $("#handin_show_assessment input[type='file']").get(0);
                var file = fileSelector.files[0];
                $("#handin-file-name").text(file.name);
              
              
              Severity: Minor
              Found in app/assets/javascripts/handin.js - About 1 hr to fix

                Function fixIE has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        fixIE: function () {
                            var s = this, p = s.o.position;
                
                            // simulate fixed position - adapted from BlockUI
                            $.each([s.d.iframe || null, !s.o.modal ? null : s.d.overlay, s.d.container.css('position') === 'fixed' ? s.d.container : null], function (i, el) {
                Severity: Minor
                Found in app/assets/javascripts/jquery.simplemodal-1.4.4.js - About 1 hr to fix

                  Method parse_members_data has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def parse_members_data(lcd, members_data)
                      cuds = @course.course_user_data.all.to_set
                      email_to_cud = {}
                      cuds.each do |cud|
                        email_to_cud[cud.user.email] = cud
                  Severity: Minor
                  Found in app/controllers/lti_nrps_controller.rb - About 1 hr to fix

                    Function finishInitialization has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        function finishInitialization() {
                          if (!initialized) {
                            initialized = true;
                    
                            viewportW = parseFloat($.css($container[0], "width", true));
                    Severity: Minor
                    Found in app/assets/javascripts/SlickGrid/2.02/slick.grid.js - About 1 hr to fix

                      Function template has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        var template = function (text) {
                          var matcher = new RegExp('<%=([\\s\\S]+?)%>|<%([\\s\\S]+?)%>|$', 'g');
                      
                          var escapes = {
                            "'": "'",
                      Severity: Minor
                      Found in app/assets/javascripts/materialize-autocomplete.js - About 1 hr to fix

                        Method oidc_login has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def oidc_login
                            unless File.size?("#{Rails.configuration.config_location}/lti_config.yml")
                              raise LtiError.new("LTI configuration not found on Autolab Server", :internal_server_error)
                            end
                        
                        
                        Severity: Minor
                        Found in app/controllers/lti_launch_controller.rb - About 1 hr to fix

                          Method formatRawJob has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def formatRawJob(rjob, is_live)
                              job = {}
                              job[:rjob] = rjob
                              job[:id] = rjob["id"]
                              job[:name] = rjob["name"]
                          Severity: Minor
                          Found in app/controllers/jobs_controller.rb - About 1 hr to fix

                            Method update_config has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def update_config
                                required_params = %w[iss developer_key auth_url oauth2_access_token_url]
                                required_params.each do |param|
                                  if params[param].blank?
                                    flash[:error] = "#{param} field was missing"
                            Severity: Minor
                            Found in app/controllers/lti_config_controller.rb - About 1 hr to fix

                              Function handler has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  handler: function( event ){ 
                                      // read the data before hijacking anything
                                      var dd = event.data;    
                                      // handle various events
                                      switch ( event.type ){
                              Severity: Minor
                              Found in app/assets/javascripts/jquery.event.drag-2.2.js - About 1 hr to fix

                                Method gradebook_rows has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  def gradebook_rows(matrix, course, section = nil, lecture = nil)
                                    rows = []
                                
                                    course.course_user_data.each do |cud|
                                      next unless matrix.has_cud? cud.id
                                Severity: Minor
                                Found in app/helpers/gradebook_helper.rb - About 1 hr to fix

                                  Method sanitize_directories has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    def self.sanitize_directories(files)
                                  
                                      cleaned_files = []
                                      file_path_set = Set[]
                                      
                                  Severity: Minor
                                  Found in lib/archive.rb - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language