autolab/Autolab

View on GitHub

Showing 572 of 572 total issues

Function pdfjsWrapper has a Cognitive Complexity of 2085 (exceeds 5 allowed). Consider refactoring.
Open

(function pdfjsWrapper() {
  // Use strict in our context only - users might not want it
  'use strict';

/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
Severity: Minor
Found in app/assets/javascripts/pdf.js - About 1 mo 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 pdfjsWrapper has 6142 lines of code (exceeds 25 allowed). Consider refactoring.
Open

(function pdfjsWrapper() {
  // Use strict in our context only - users might not want it
  'use strict';

/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
Severity: Major
Found in app/assets/javascripts/pdf.js - About 1 mo to fix

    File pdf.js has 6160 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
    /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
    /* Copyright 2012 Mozilla Foundation
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
    Severity: Major
    Found in app/assets/javascripts/pdf.js - About 2 wks to fix

      Function SlickGrid has 2728 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function SlickGrid(container, data, columns, options) {
          // settings
          var defaults = {
            explicitInitialization: false,
            rowHeight: 25,
      Severity: Major
      Found in app/assets/javascripts/SlickGrid/2.02/slick.grid.js - About 1 wk to fix

        File slick.grid.js has 2748 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /**
         * @license
         * (c) 2009-2013 Michael Leibman
         * michael{dot}leibman{at}gmail{dot}com
         * http://github.com/mleibman/slickgrid
        Severity: Major
        Found in app/assets/javascripts/SlickGrid/2.02/slick.grid.js - About 1 wk to fix

          Function CanvasGraphicsClosure has 1422 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var CanvasGraphics = (function CanvasGraphicsClosure() {
            // Defines the time the executeOperatorList is going to be executing
            // before it stops and shedules a continue of execution.
            var EXECUTION_TIME = 15;
            // Defines the number of steps before checking the execution time
          Severity: Major
          Found in app/assets/javascripts/pdf.js - About 1 wk to fix

            Function SVGGraphicsClosure has 801 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            var SVGGraphics = (function SVGGraphicsClosure() {
              function createScratchSVG(width, height) {
                var NS = 'http://www.w3.org/2000/svg';
                var svg = document.createElementNS(NS, 'svg:svg');
                svg.setAttributeNS(null, 'version', '1.1');
            Severity: Major
            Found in app/assets/javascripts/pdf.js - About 4 days to fix

              Function DataView has 635 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                function DataView(options) {
                  var self = this;
              
                  var defaults = {
                    groupItemMetadataProvider: null,
              Severity: Major
              Found in app/assets/javascripts/SlickGrid/2.02/slick.dataview.js - About 3 days to fix

                Function WorkerTransportClosure has 378 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

                  Function WebGLUtilsClosure has 355 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  var WebGLUtils = (function WebGLUtilsClosure() {
                    function loadShader(gl, code, shaderType) {
                      var shader = gl.createShader(shaderType);
                      gl.shaderSource(shader, code);
                      gl.compileShader(shader);
                  Severity: Major
                  Found in app/assets/javascripts/pdf.js - About 1 day to fix

                    Function add has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring.
                    Open

                        'add': function(shortcut_combination,callback,opt) {
                            //Provide a set of default options
                            var default_options = {
                                'type':'keydown',
                                'propagate':false,
                    Severity: Minor
                    Found in app/assets/javascripts/shortcut.js - About 1 day 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 slick.dataview.js has 734 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    (function ($) {
                      $.extend(true, window, {
                        Slick: {
                          Data: {
                            DataView: DataView,
                    Severity: Major
                    Found in app/assets/javascripts/SlickGrid/2.02/slick.dataview.js - About 1 day to fix

                      Class Assessment has 81 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      class Assessment < ApplicationRecord
                        # Mass-assignment
                        # attr_protected :name
                      
                        # Associations
                      Severity: Major
                      Found in app/models/assessment.rb - About 1 day to fix

                        File watchlist.js has 622 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        // Loads all Semantic javascripts
                        //= require semantic-ui
                        
                        const escapeHtml = (unsafe) => {
                          return unsafe.replaceAll('&', '&amp;')
                        Severity: Major
                        Found in app/assets/javascripts/watchlist.js - About 1 day to fix

                          Function PromiseClosure has 248 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          (function PromiseClosure() {
                            if (globalScope.Promise) {
                              // Promises existing in the DOM/Worker, checking presence of all/resolve
                              if (typeof globalScope.Promise.all !== 'function') {
                                globalScope.Promise.all = function (iterable) {
                          Severity: Major
                          Found in app/assets/javascripts/pdf.js - About 1 day to fix

                            Function editable has 233 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                $.fn.editable = function(target, options) {
                                        
                                    if ('disable' == target) {
                                        $(this).data('disabled.editable', true);
                                        return;
                            Severity: Major
                            Found in app/assets/javascripts/jquery.jeditable.js - About 1 day to fix

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

                                function MaxAggregator(field) {
                                  this.field_ = field;
                              
                                  this.init = function () {
                                    this.max_ = null;
                              Severity: Major
                              Found in app/assets/javascripts/SlickGrid/2.02/slick.dataview.js and 1 other location - About 1 day to fix
                              app/assets/javascripts/SlickGrid/2.02/slick.dataview.js on lines 836..858

                              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 209.

                              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

                                function MinAggregator(field) {
                                  this.field_ = field;
                              
                                  this.init = function () {
                                    this.min_ = null;
                              Severity: Major
                              Found in app/assets/javascripts/SlickGrid/2.02/slick.dataview.js and 1 other location - About 1 day to fix
                              app/assets/javascripts/SlickGrid/2.02/slick.dataview.js on lines 860..882

                              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 209.

                              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

                              Method show has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def show
                                  # It turns out that it's faster to just get everything and let the
                                  # view handle it
                                  problemQuery = "SELECT scores.score AS score,
                                      submissions.version AS version,
                              Severity: Minor
                              Found in app/controllers/scoreboards_controller.rb - About 1 day 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 assessment.rb has 509 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              require "archive"
                              require "association_cache"
                              require "fileutils"
                              require "utilities"
                              class Assessment < ApplicationRecord
                              Severity: Major
                              Found in app/models/assessment.rb - About 1 day to fix
                                Severity
                                Category
                                Status
                                Source
                                Language