autolab/Autolab

View on GitHub

Showing 572 of 572 total issues

Function WorkerTransport_setupMessageHandler has 205 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      function WorkerTransport_setupMessageHandler(messageHandler) {
      this.messageHandler = messageHandler;

      function updatePassword(password) {
        messageHandler.send('UpdatePassword', password);
Severity: Major
Found in app/assets/javascripts/pdf.js - About 1 day to fix

    Function get_watchlist_function has 192 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function get_watchlist_function(){
    
      var pending_instances = {}
      var contacted_instances = {}
      var resolved_instances = {}
    Severity: Major
    Found in app/assets/javascripts/watchlist.js - About 7 hrs to fix

      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

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

                $.ajax({
                    url:metrics_config_endpoints['update'],
                    dataType: "json",
                    contentType:'application/json',
                    data: JSON.stringify(new_data),
            Severity: Major
            Found in app/assets/javascripts/metrics_config.js and 1 other location - About 6 hrs to fix
            app/assets/javascripts/metrics.js on lines 189..215

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 170.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                $.ajax({
                    url: metrics_endpoints['update'],
                    dataType: "json",
                    contentType:'application/json',
                    data: JSON.stringify(new_conditions),
            Severity: Major
            Found in app/assets/javascripts/metrics.js and 1 other location - About 6 hrs to fix
            app/assets/javascripts/metrics_config.js on lines 71..97

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 170.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language