autolab/Autolab

View on GitHub

Showing 419 of 572 total issues

Function composeSMask has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function composeSMask(layer, mask, properties) {
    var width = layer.width, height = layer.height;

    if (!smaskCache) {
      initSmaskGL();
Severity: Minor
Found in app/assets/javascripts/pdf.js - About 1 hr to fix

    Function SVGExtraStateClosure has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var SVGExtraState = (function SVGExtraStateClosure() {
      function SVGExtraState() {
        this.fontSizeScale = 1;
        this.fontWeight = SVG_DEFAULTS.fontWeight;
        this.fontSize = 0;
    Severity: Minor
    Found in app/assets/javascripts/pdf.js - About 1 hr to fix

      Method shibboleth has 40 lines of code (exceeds 25 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 1 hr to fix

        Method authorize_user_for_course has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def authorize_user_for_course
            redirect_to(root_path) && return if current_user.nil?
        
            uid = current_user.id
            # don't allow sudoing across courses
        Severity: Minor
        Found in app/controllers/application_controller.rb - About 1 hr to fix

          Method tango_upload has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

            def tango_upload(course, assessment, submission, existing_files)
              # first, figure out which files need to get sent
              ass_dir = assessment.folder_path
              begin
                COURSE_LOGGER.log("Dir: #{ass_dir}")
          Severity: Minor
          Found in app/helpers/assessment_autograde_core.rb - About 1 hr 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 validated_score_value has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.validated_score_value(score, invoked_method_name, allow_nil = false)
              message = "Error executing #{invoked_method_name}"
          
              if score
                if (score = Float(score) rescue nil)
          Severity: Minor
          Found in lib/utilities.rb - About 1 hr 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 request_access_token has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

            def request_access_token
              # get private key from JSON file to sign Autolab's client assertion as a JWK
              unless File.size?("#{Rails.configuration.config_location}/lti_tool_jwk.json")
                flash[:error] = "Autolab's JWK JSON file was not found"
                redirect_to([:users, @course]) && return
          Severity: Minor
          Found in app/controllers/lti_nrps_controller.rb - About 1 hr 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 log_submit has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

            def log_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 1 hr 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 create has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

            def create
              require_params([:groups])
          
              if @assessment.group_size <= 1
                raise ApiError.new("Group size of assessment is currently 1,"\
          Severity: Minor
          Found in app/controllers/api/v1/groups_controller.rb - About 1 hr 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 Promise_all has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            Promise.all = function Promise_all(promises) {
              var resolveAll, rejectAll;
              var deferred = new Promise(function (resolve, reject) {
                resolveAll = resolve;
                rejectAll = reject;
          Severity: Minor
          Found in app/assets/javascripts/pdf.js - About 1 hr to fix

            Function navigate has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function navigate(dir) {
                  if (!options.enableCellNavigation) {
                    return false;
                  }
            
            Severity: Minor
            Found in app/assets/javascripts/SlickGrid/2.02/slick.grid.js - About 1 hr to fix

              Method deserialize has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def deserialize(s)
                  unless s["general"]
                    raise "General section missing in yaml"
                  end
              
              
              Severity: Minor
              Found in app/models/assessment.rb - About 1 hr to fix

                Function messageHandlerComObjOnMessage has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  comObj.onmessage = function messageHandlerComObjOnMessage(event) {
                    var data = event.data;
                    if (data.isReply) {
                      var callbackId = data.callbackId;
                      if (data.callbackId in callbacksCapabilities) {
                Severity: Minor
                Found in app/assets/javascripts/pdf.js - About 1 hr to fix

                  Function makeActiveCellEditable has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function makeActiveCellEditable(editor) {
                        if (!activeCellNode) {
                          return;
                        }
                        if (!options.editable) {
                  Severity: Minor
                  Found in app/assets/javascripts/SlickGrid/2.02/slick.grid.js - About 1 hr to fix

                    Method tango_upload has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def tango_upload(course, assessment, submission, existing_files)
                        # first, figure out which files need to get sent
                        ass_dir = assessment.folder_path
                        begin
                          COURSE_LOGGER.log("Dir: #{ass_dir}")
                    Severity: Minor
                    Found in app/helpers/assessment_autograde_core.rb - About 1 hr to fix

                      Function setContainerDimensions has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              setContainerDimensions: function () {
                                  var s = this,
                                      badIE = browser.ie6 || browser.ie7;
                      
                                  // get the dimensions for the container and data
                      Severity: Minor
                      Found in app/assets/javascripts/jquery.simplemodal-1.4.4.js - About 1 hr to fix

                        Method sendJob_AddHTMLMessages has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def sendJob_AddHTMLMessages(course, assessment, submissions)
                            # Check for nil first, since students should know about this
                            flash[:error] = "Submission could not be autograded due to an error in creation" && return if submissions.blank?
                        
                            begin
                        Severity: Minor
                        Found in app/controllers/assessment/autograde.rb - About 1 hr to fix

                          Function SVGGraphics_setGState has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              setGState: function SVGGraphics_setGState(states) {
                                for (var i = 0, ii = states.length; i < ii; i++) {
                                  var state = states[i];
                                  var key = state[0];
                                  var value = state[1];
                          Severity: Minor
                          Found in app/assets/javascripts/pdf.js - About 1 hr to fix

                            Function init has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                init: function( event ){ 
                                    // sorry, only one touch at a time
                                    if ( drag.touched ) 
                                        return;
                                    // the drag/drop interaction data
                            Severity: Minor
                            Found in app/assets/javascripts/jquery.event.drag-2.2.js - About 1 hr to fix

                              Method populate_directory has 37 lines of code (exceeds 25 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 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language