autolab/Autolab

View on GitHub

Showing 419 of 572 total issues

Function TilinPattern_createPatternCanvas has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    createPatternCanvas: function TilinPattern_createPatternCanvas(owner) {
      var operatorList = this.operatorList;
      var bbox = this.bbox;
      var xstep = this.xstep;
      var ystep = this.ystep;
Severity: Minor
Found in app/assets/javascripts/pdf.js - About 1 hr to fix

    Function CanvasExtraStateClosure has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var CanvasExtraState = (function CanvasExtraStateClosure() {
      function CanvasExtraState(old) {
        // Are soft masks and alpha values shapes or opacities?
        this.alphaIsShape = false;
        this.fontSize = 0;
    Severity: Minor
    Found in app/assets/javascripts/pdf.js - About 1 hr to fix

      Function defaultFormatter has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        defaultFormatter: function(row, cell, value, columnDef, data) {
          user = data.email;
          asmt = columnDef.name;
      
          submission_status_key = columnDef.field + "_submission_status"
      Severity: Minor
      Found in app/assets/javascripts/gradebook.js - About 1 hr to fix

        Function init has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                init: function (data, options) {
                    var s = this;
        
                    // don't allow multiple calls
                    if (s.d.data) {
        Severity: Minor
        Found in app/assets/javascripts/jquery.simplemodal-1.4.4.js - About 1 hr to fix

          Method parse_csv_row has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def parse_csv_row(row, kind, problems, emails)
              row = row.dup
          
              email = row.shift.to_s
              data = row.shift problems.count
          Severity: Minor
          Found in app/controllers/assessment/grading.rb - About 1 hr to fix

            Method visual_run has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def visual_run
                action = Scheduler.find(params[:scheduler_id])
                # https://stackoverflow.com/a/1076445
                read, write = IO.pipe
                @log = "Executing #{Rails.root.join(action.action)}\n"
            Severity: Minor
            Found in app/controllers/schedulers_controller.rb - About 1 hr to fix

              Method backwards_compatibility has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                def backwards_compatibility(props)
                  GENERAL_BC.each do |old, new|
                    next unless props["general"].key?(old)
              
                    props["general"][new] = props["general"][old] unless new.nil?
              Severity: Minor
              Found in app/models/assessment.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 csv_row_for has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                def csv_row_for(asmt, cud, as_seen_by)
                  aud = AssessmentUserDatum.get asmt.id, cud.id
                  throw "csv_row_for: no AUD for (#{asmt.id}, #{cud.id})" unless aud
              
                  # create csv row with latest submission time and user email (first and second columns)
              Severity: Minor
              Found in app/helpers/assessment_helper.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 index has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                def index
                  # Instance variables that will be used by the view
                  @running_jobs = []   # running jobs
                  @waiting_jobs = []   # jobs waiting in job queue
                  @dead_jobs = []      # dead jobs culled from dead job queue
              Severity: Minor
              Found in app/controllers/jobs_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

              Method facebook has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                def facebook
                  if user_signed_in?
                    # add this authentication object to current user
                    if (data = request.env["omniauth.auth"]) && current_user.authentications.where(provider: data["provider"],
                                                                                                   uid: data["uid"]).empty?
              Severity: Minor
              Found in app/controllers/users/omniauth_callbacks_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

              Method stats_for_grader has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                def stats_for_grader(submissions)
                  result = []
                  problem_id_to_name = @assessment.problem_id_to_name
                  stats = Statistics.new
              
              
              Severity: Minor
              Found in app/controllers/assessment/grading.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 sendJob_AddHTMLMessages has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                def sendJob_AddHTMLMessages(course, assessment, submissions)
                  # Check for nil first, since students should know about this
                  flash[:error] = "Submission could not be autograded due to an error in creation" && return if submissions.blank?
              
                  begin
              Severity: Minor
              Found in app/controllers/assessment/autograde.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 authorize_user_for_course has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                def authorize_user_for_course
                  redirect_to(root_path) && return if current_user.nil?
              
                  uid = current_user.id
                  # don't allow sudoing across courses
              Severity: Minor
              Found in app/controllers/application_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

              Method autograde_done has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                def autograde_done
                  @assessment = @course.assessments.find_by(name: params[:name])
                  head(:no_content) && return unless @assessment && @assessment.has_autograder?
                  ASSESSMENT_LOGGER.setAssessment(@assessment)
              
              
              Severity: Minor
              Found in app/controllers/assessment/autograde.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 Mesh_fromIR has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                fromIR: function Mesh_fromIR(raw) {
                  //var type = raw[1];
                  var coords = raw[2];
                  var colors = raw[3];
                  var figures = raw[4];
              Severity: Minor
              Found in app/assets/javascripts/pdf.js - About 1 hr to fix

                Method external_javascript_include_tag has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def external_javascript_include_tag(library)
                    cloudflare = "//cdnjs.cloudflare.com/ajax/libs"
                
                    # Update versions manually as-and-when newer versions become available on the CDN
                    case library
                Severity: Minor
                Found in app/helpers/application_helper.rb - About 1 hr to fix

                  Method colspec_is_well_formed has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def colspec_is_well_formed
                      # An empty spec is OK
                      return if colspec.blank?
                  
                      # The parse will throw an exception if the string has a JSON syntax error
                  Severity: Minor
                  Found in app/models/scoreboard.rb - About 1 hr to fix

                    Function initSmaskGL has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      function initSmaskGL() {
                        var canvas, gl;
                    
                        generateGL();
                        canvas = currentCanvas;
                    Severity: Minor
                    Found in app/assets/javascripts/pdf.js - About 1 hr to fix

                      Function get_buttons_html has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function get_buttons_html(user_id, tab, archived_instances) {
                        var archived_icon = (user_id in archived_instances) ? 
                            `<div class="left ui icon" data-content="Student also appears in archived">
                              <i class="exclamation circle icon"></i>
                            </div>` : "";
                      Severity: Minor
                      Found in app/assets/javascripts/watchlist.js - About 1 hr to fix

                        Function plot_diagram has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          var plot_diagram = function(pool) {
                            current_plot = pool;
                            var title = "Job Runtime History for ";
                            title += pool == '' ? "Global" : pool;
                            MG.data_graphic({
                        Severity: Minor
                        Found in app/assets/javascripts/tango_status.js - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language