autolab/Autolab

View on GitHub

Showing 419 of 572 total issues

Function materialize_autocomplete has 84 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  $.fn.materialize_autocomplete = function (options) {
    var el = this;
    var $el = $(el).eq(0);
    var instance = $el.data('autocomplete');

Severity: Major
Found in app/assets/javascripts/materialize-autocomplete.js - About 3 hrs to fix

    Consider simplifying this complex logical expression.
    Open

              if ((groupingGetter && (eitherIsNonData = (item.__nonDataRow) || (r.__nonDataRow)) &&
                  item.__group !== r.__group ||
                  item.__updated ||
                  item.__group && !item.equals(r))
                  || (aggregators && eitherIsNonData &&
    Severity: Critical
    Found in app/assets/javascripts/SlickGrid/2.02/slick.dataview.js - About 3 hrs to fix

      Method save_entries has a Cognitive Complexity of 23 (exceeds 5 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 3 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 handin.rb has 301 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require "pathname"
      
      ##
      # Handles different handin methods, including web form, local_submit and log_submit
      #
      Severity: Minor
      Found in app/controllers/assessment/handin.rb - About 3 hrs to fix

        File application_controller.rb has 299 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        class ApplicationController < ActionController::Base
          helper :all # include all helpers, all the time
        
          before_action :configure_permitted_parameters, if: :devise_controller?
          before_action :maintenance_mode?
        Severity: Minor
        Found in app/controllers/application_controller.rb - About 3 hrs to fix

          Method handin has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

            def handin
              if @assessment.disable_handins?
                flash[:error] = "Sorry, handins are disabled for this assessment."
                redirect_to(action: :show)
                return false
          Severity: Minor
          Found in app/controllers/assessment/handin.rb - About 3 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 plotEventDrops has 77 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var plotEventDrops = function(data) {
            var minDates = jQuery.map(data, function(h) {
              return Math.min.apply(null, h['dates']);
            });
            var startTime = new Date(Math.min.apply(null, minDates));
          Severity: Major
          Found in app/assets/javascripts/tango_status.js - About 3 hrs to fix

            Function PageViewportClosure has 74 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            var PageViewport = PDFJS.PageViewport = (function PageViewportClosure() {
              /**
               * @constructor
               * @private
               * @param viewBox {Array} xMin, yMin, xMax and yMax coordinates.
            Severity: Major
            Found in app/assets/javascripts/pdf.js - About 2 hrs to fix

              Function SVGGraphics_constructPath has 74 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  constructPath: function SVGGraphics_constructPath(ops, args) {
                    var current = this.current;
                    var x = current.x, y = current.y;
                    current.path = document.createElementNS(NS, 'svg:path');
                    var d = [];
              Severity: Major
              Found in app/assets/javascripts/pdf.js - About 2 hrs to fix

                Function fontLoaderPrepareFontLoadEvent has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  prepareFontLoadEvent: function fontLoaderPrepareFontLoadEvent(rules,
                                                                                fonts,
                                                                                request) {
                      /** Hack begin */
                      // There's currently no event when a font has finished downloading so the
                Severity: Major
                Found in app/assets/javascripts/pdf.js - About 2 hrs to fix

                  Method rename has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def rename
                      absolute_path = check_path_exist(params[:relative_path])
                      if check_instructor(absolute_path)
                        parent = absolute_path.parent
                        if parent == BASE_DIRECTORY
                  Severity: Minor
                  Found in app/controllers/file_manager_controller.rb - About 2 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 CanvasGraphics_beginGroup has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      beginGroup: function CanvasGraphics_beginGroup(group) {
                        this.save();
                        var currentCtx = this.ctx;
                        // TODO non-isolated groups - according to Rik at adobe non-isolated
                        // group results aren't usually that different and they even have tools
                  Severity: Major
                  Found in app/assets/javascripts/pdf.js - About 2 hrs to fix

                    Method render_error has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def render_error(exception)
                        # use the exception_notifier gem to send out an e-mail
                        # to the notification list specified in config/environment.rb
                        ExceptionNotifier.notify_exception(exception, env: request.env,
                                                                      data: {
                    Severity: Minor
                    Found in app/controllers/application_controller.rb - About 2 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 PDFPageProxy_render has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        render: function PDFPageProxy_render(params) {
                          var stats = this.stats;
                          stats.time('Overall');
                    
                          // If there was a pending destroy cancel it so no cleanup happens during
                    Severity: Major
                    Found in app/assets/javascripts/pdf.js - About 2 hrs to fix

                      Function createColumnHeaders has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function createColumnHeaders() {
                            function onMouseEnter() {
                              $(this).addClass("ui-state-hover");
                            }
                      
                      Severity: Major
                      Found in app/assets/javascripts/SlickGrid/2.02/slick.grid.js - About 2 hrs to fix

                        Function sorttables has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        var sorttables = (function($) { return function() {
                            $('.sortable').each(function() {
                        
                                var $table = $(this);
                                $table.find('th').each(function() {
                        Severity: Major
                        Found in app/assets/javascripts/sorttable.js - About 2 hrs to fix

                          Function get_condition_html has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function get_condition_html(condition_types) {
                            var conditions_html = "";
                            $.each(condition_types, function( condition, violations ) {
                              var condition_string = "";
                              var violation_string = "";
                          Severity: Major
                          Found in app/assets/javascripts/watchlist.js - About 2 hrs to fix

                            Function autosizeColumns has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                function autosizeColumns() {
                                  var i, c,
                                      widths = [],
                                      shrinkLeeway = 0,
                                      total = 0,
                            Severity: Major
                            Found in app/assets/javascripts/SlickGrid/2.02/slick.grid.js - About 2 hrs to fix

                              Function MetadataClosure has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              var Metadata = PDFJS.Metadata = (function MetadataClosure() {
                                function fixMetadata(meta) {
                                  return meta.replace(/>\\376\\377([^<]+)/g, function(all, codes) {
                                    var bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g,
                                                              function(code, d1, d2, d3) {
                              Severity: Major
                              Found in app/assets/javascripts/pdf.js - About 2 hrs to fix

                                Function StickyTableHeaders has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    $.StickyTableHeaders = function (el, options) {
                                        // To avoid scope issues, use 'base' instead of 'this'
                                        // to reference this class from internal events and functions.
                                        var base = this;
                                
                                
                                Severity: Major
                                Found in app/assets/javascripts/jquery.stickytableheaders.js - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language