autolab/Autolab

View on GitHub

Showing 419 of 572 total issues

Function AutoColumnSize has 124 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function AutoColumnSize(maxWidth) {

        var grid, $container, context,
            keyCodes = {
                'A': 65
Severity: Major
Found in app/assets/javascripts/SlickGrid/2.02/plugins/slick.autocolumnsize.js - About 4 hrs to fix

    Method saveAutograde has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
    Open

      def saveAutograde(submissions, feedback)
        begin
          # Set job id to nil to indicate that autograding is no longer in-progress
          ActiveRecord::Base.transaction do
            submissions.each do |submission|
    Severity: Minor
    Found in app/helpers/assessment_autograde_core.rb - About 4 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 jquery.jeditable.js has 363 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     * Jeditable - jQuery in place edit plugin
     *
     * Copyright (c) 2006-2009 Mika Tuupola, Dylan Verheul
     *
    Severity: Minor
    Found in app/assets/javascripts/jquery.jeditable.js - About 4 hrs to fix

      Method show has 117 lines of code (exceeds 25 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: Major
      Found in app/controllers/scoreboards_controller.rb - About 4 hrs to fix

        Method gradebook_rows has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
        Open

          def gradebook_rows(matrix, course, section = nil, lecture = nil)
            rows = []
        
            course.course_user_data.each do |cud|
              next unless matrix.has_cud? cud.id
        Severity: Minor
        Found in app/helpers/gradebook_helper.rb - About 4 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

        Method shibboleth has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
        Open

          def shibboleth
            if user_signed_in?
              if (data = request.env["omniauth.auth"]) && current_user.authentications.where(provider: "CMU-Shibboleth",
                                                                                             uid: data["uid"]).empty?
                current_user.authentications.create(provider: "CMU-Shibboleth",
        Severity: Minor
        Found in app/controllers/users/omniauth_callbacks_controller.rb - About 4 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

        Method local_submit has 108 lines of code (exceeds 25 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: Major
        Found in app/controllers/assessment/handin.rb - About 4 hrs to fix

          Function CanvasGraphics_showText has 107 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              showText: function CanvasGraphics_showText(glyphs) {
                var current = this.current;
                var font = current.font;
                if (font.isType3Font) {
                  return this.showType3Text(glyphs);
          Severity: Major
          Found in app/assets/javascripts/pdf.js - About 4 hrs to fix

            Function drawFigures has 107 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function drawFigures(width, height, backgroundColor, figures, context) {
                if (!figuresCache) {
                  initFiguresGL();
                }
                var cache = figuresCache, canvas = cache.canvas, gl = cache.gl;
            Severity: Major
            Found in app/assets/javascripts/pdf.js - About 4 hrs to fix

              Function TilingPatternClosure has 107 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              var TilingPattern = (function TilingPatternClosure() {
                var PaintType = {
                  COLORED: 1,
                  UNCOLORED: 2
                };
              Severity: Major
              Found in app/assets/javascripts/pdf.js - About 4 hrs to fix

                Method populate_directory has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                Open

                  def populate_directory(current_directory, current_url)
                    directory = Dir.entries(current_directory)
                    new_url = current_url == '/' ? '' : current_url
                    @directory = directory.map do |file|
                      abs_path_str = "#{current_directory}/#{file}"
                Severity: Minor
                Found in app/controllers/file_manager_controller.rb - About 4 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 encode has 100 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  function encode(imgData, kind) {
                    var width = imgData.width;
                    var height = imgData.height;
                    var bitDepth, colorType, lineSize;
                    var bytes = imgData.data;
                Severity: Major
                Found in app/assets/javascripts/pdf.js - About 4 hrs to fix

                  Method upload_file has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def upload_file(path)
                      absolute_path = check_path_exist(path)
                      if Archive.in_dir?(BASE_DIRECTORY, absolute_path, strict: false)
                        raise "You cannot upload files/create folders in the root directory click " \
                          "#{view_context.link_to 'here', new_course_url, method: 'get'}" \
                  Severity: Minor
                  Found in app/controllers/file_manager_controller.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 getHtmlElementForTextAnnotation has 97 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    function getHtmlElementForTextAnnotation(item) {
                      var rect = item.rect;
                  
                      // sanity check because of OOo-generated PDFs
                      if ((rect[3] - rect[1]) < ANNOT_MIN_SIZE) {
                  Severity: Major
                  Found in app/assets/javascripts/pdf.js - About 3 hrs to fix

                    Function InternalRenderTaskClosure has 93 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    var InternalRenderTask = (function InternalRenderTaskClosure() {
                    
                      function InternalRenderTask(callback, params, objs, commonObjs, operatorList,
                                                  pageNumber) {
                        this.callback = callback;
                    Severity: Major
                    Found in app/assets/javascripts/pdf.js - About 3 hrs to fix

                      Function putBinaryImageData has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        function putBinaryImageData(ctx, imgData) {
                          if (typeof ImageData !== 'undefined' && imgData instanceof ImageData) {
                            ctx.putImageData(imgData, 0, 0);
                            return;
                          }
                      Severity: Major
                      Found in app/assets/javascripts/pdf.js - About 3 hrs to fix

                        Function addContextCurrentTransform has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function addContextCurrentTransform(ctx) {
                          // If the context doesn't expose a `mozCurrentTransform`, add a JS based on.
                          if (!ctx.mozCurrentTransform) {
                            // Store the original context
                            ctx._scaleX = ctx._scaleX || 1.0;
                        Severity: Major
                        Found in app/assets/javascripts/pdf.js - About 3 hrs to fix

                          Method saveAutograde has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def saveAutograde(submissions, feedback)
                              begin
                                # Set job id to nil to indicate that autograding is no longer in-progress
                                ActiveRecord::Base.transaction do
                                  submissions.each do |submission|
                          Severity: Major
                          Found in app/helpers/assessment_autograde_core.rb - About 3 hrs to fix

                            Method parse_members_data has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def parse_members_data(lcd, members_data)
                                cuds = @course.course_user_data.all.to_set
                                email_to_cud = {}
                                cuds.each do |cud|
                                  email_to_cud[cud.user.email] = cud
                            Severity: Minor
                            Found in app/controllers/lti_nrps_controller.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

                            Method tango_plot_data has 86 lines of code (exceeds 25 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: Major
                            Found in app/controllers/jobs_controller.rb - About 3 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language