autolab/Autolab

View on GitHub

Showing 419 of 572 total issues

Function PDFPageProxyClosure has 190 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var PDFPageProxy = (function PDFPageProxyClosure() {
  function PDFPageProxy(pageIndex, pageInfo, transport) {
    this.pageIndex = pageIndex;
    this.pageInfo = pageInfo;
    this.transport = transport;
Severity: Major
Found in app/assets/javascripts/pdf.js - About 7 hrs to fix

    Function AnnotationUtilsClosure has 182 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var AnnotationUtils = (function AnnotationUtilsClosure() {
      // TODO(mack): This dupes some of the logic in CanvasGraphics.setFont()
      function setTextStyles(element, item, fontObj) {
    
        var style = element.style;
    Severity: Major
    Found in app/assets/javascripts/pdf.js - About 7 hrs to fix

      Method local_submit has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
      Open

        def local_submit
          @user = User.find_by(email: params[:user])
          @cud = @user ? @course.course_user_data.find_by(user_id: @user.id) : nil
          unless @cud
            err = "ERROR: invalid username (#{params[:user]}) for class #{@course.id}"
      Severity: Minor
      Found in app/controllers/assessment/handin.rb - About 7 hrs 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

      File materialize-autocomplete.js has 459 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      (function (root, factory) {
      
        if(typeof module === 'object' && module.exports) {
          module.exports = factory(require('jquery'));
        } else if(typeof define === 'function' && define.amd) {
      Severity: Minor
      Found in app/assets/javascripts/materialize-autocomplete.js - About 7 hrs to fix

        Function add has 162 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            'add': function(shortcut_combination,callback,opt) {
                //Provide a set of default options
                var default_options = {
                    'type':'keydown',
                    'propagate':false,
        Severity: Major
        Found in app/assets/javascripts/shortcut.js - About 6 hrs to fix

          Function convertImgDataToPngClosure has 161 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var convertImgDataToPng = (function convertImgDataToPngClosure() {
            var PNG_HEADER =
              new Uint8Array([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
          
            var CHUNK_WRAPPER_SIZE = 12;
          Severity: Major
          Found in app/assets/javascripts/pdf.js - About 6 hrs to fix

            Function setupColumnResize has 160 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function setupColumnResize() {
                  var $col, j, c, pageX, columnElements, minPageX, maxPageX, firstResizable, lastResizable;
                  columnElements = $headers.children();
                  columnElements.find(".slick-resizable-handle").remove();
                  columnElements.each(function (i, e) {
            Severity: Major
            Found in app/assets/javascripts/SlickGrid/2.02/slick.grid.js - About 6 hrs to fix

              Function brushing has 157 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function brushing() {
                  var chartContext = this;
              
                  args = this.args;
              
              
              Severity: Major
              Found in app/assets/javascripts/metricsgraphics_brushing.js - About 6 hrs to fix

                Function UtilClosure has 150 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                var Util = PDFJS.Util = (function UtilClosure() {
                  function Util() {}
                
                  var rgbBuf = ['rgb(', 0, ',', 0, ',', 0, ')'];
                
                
                Severity: Major
                Found in app/assets/javascripts/pdf.js - About 6 hrs to fix

                  File jquery.simplemodal-1.4.4.js has 411 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  /*
                   * SimpleModal 1.4.4 - jQuery Plugin
                   * http://simplemodal.com/
                   * Copyright (c) 2013 Eric Martin
                   * Licensed under MIT and GPL
                  Severity: Minor
                  Found in app/assets/javascripts/jquery.simplemodal-1.4.4.js - About 5 hrs to fix

                    Function createMeshCanvasClosure has 146 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    var createMeshCanvas = (function createMeshCanvasClosure() {
                      function drawTriangle(data, context, p1, p2, p3, c1, c2, c3) {
                        // Very basic Gouraud-shaded triangle rasterization algorithm.
                        var coords = context.coords, colors = context.colors;
                        var bytes = data.data, rowSize = data.width * 4;
                    Severity: Major
                    Found in app/assets/javascripts/pdf.js - About 5 hrs to fix

                      File assessment_autograde_core.rb has 399 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      require "uri"
                      require "tango_client"
                      require_relative Rails.root.join("config", "autogradeConfig.rb")
                      
                      module AssessmentAutogradeCore
                      Severity: Minor
                      Found in app/helpers/assessment_autograde_core.rb - About 5 hrs to fix

                        Function SVGGraphics_executeOpTree has 139 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            executeOpTree: function SVGGraphics_executeOpTree(opTree) {
                              var opTreeLen = opTree.length;
                              for(var x = 0; x < opTreeLen; x++) {
                                var fn = opTree[x].fn;
                                var fnId = opTree[x].fnId;
                        Severity: Major
                        Found in app/assets/javascripts/pdf.js - About 5 hrs to fix

                          Function HeaderMenu has 138 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              function HeaderMenu(options) {
                                  var _grid;
                                  var _self = this;
                                  var _handler = new Slick.EventHandler();
                                  var _defaults = {
                          Severity: Major
                          Found in app/assets/javascripts/SlickGrid/2.02/plugins/slick.headermenu.js - About 5 hrs to fix

                            Function initialize has 137 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                initialize: function () {
                                  var self = this;
                                  var timer;
                                  var fetching = false;
                            
                            
                            Severity: Major
                            Found in app/assets/javascripts/materialize-autocomplete.js - About 5 hrs to fix

                              Method getjob has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def getjob
                                  # Make sure we have a job id parameter
                                  if !params[:id]
                                    flash[:error] = "Error: missing job ID parameter in URL"
                                    redirect_to(controller: "jobs", item: nil) && return
                              Severity: Minor
                              Found in app/controllers/jobs_controller.rb - About 5 hrs 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

                              File grading.rb has 392 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              require "csv"
                              require "utilities"
                              
                              module AssessmentGrading
                                # Export all scores for an assessment for all students as CSV
                              Severity: Minor
                              Found in app/controllers/assessment/grading.rb - About 5 hrs to fix

                                Function func has 135 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                        var func = function(e) {
                                            e = e || window.event;
                                            
                                            if(opt['disable_in_input']) { //Don't enable shortcut keys in Input, Textarea fields
                                                var element;
                                Severity: Major
                                Found in app/assets/javascripts/shortcut.js - About 5 hrs to fix

                                  Method tango_plot_data has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    def tango_plot_data(live_jobs = nil, dead_jobs = nil)
                                      live_jobs ||= TangoClient.jobs
                                      dead_jobs ||= TangoClient.jobs(1)
                                      @plot_data = { new_jobs: { name: "New Job Requests", dates: [], job_name: [], job_id: [],
                                                                 vm_pool: [], vm_id: [], status: [], duration: [] },
                                  Severity: Minor
                                  Found in app/controllers/jobs_controller.rb - About 5 hrs 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 compileType3Glyph has 127 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  function compileType3Glyph(imgData) {
                                    var POINT_TO_PROCESS_LIMIT = 1000;
                                  
                                    var width = imgData.width, height = imgData.height;
                                    var i, j, j0, width1 = width + 1;
                                  Severity: Major
                                  Found in app/assets/javascripts/pdf.js - About 5 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language