autolab/Autolab

View on GitHub

Showing 419 of 572 total issues

Function absBox has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function absBox(elem) {
      var box = {
        top: elem.offsetTop,
        left: elem.offsetLeft,
        bottom: 0,
Severity: Minor
Found in app/assets/javascripts/SlickGrid/2.02/slick.grid.js - About 1 hr to fix

    Function enableSubmit has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function enableSubmit() {
      var checkbox = document.getElementById("integrity_checkbox");
      var tab = $(".submission-panel .ui.tab.active").attr('id');
      var fileSelector = $("#handin_show_assessment input[type='file']").get(0);
      if (tab === "github_tab") {
    Severity: Minor
    Found in app/assets/javascripts/handin.js - About 1 hr to fix

      Method tango_poll has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def tango_poll(course, assessment, submissions, output_file)
          feedback = nil
          begin
            Timeout.timeout(80) do
              loop do
      Severity: Minor
      Found in app/helpers/assessment_autograde_core.rb - About 1 hr to fix

        Method validate_jwt_signature has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def validate_jwt_signature(id_token)
            # use JWK URL over file
            if !@lti_config_hash["platform_public_jwks_url"].nil? &&
               @lti_config_hash["platform_public_jwks_url"].present?
              # fetch JWKS from provided keys URL
        Severity: Minor
        Found in app/controllers/lti_launch_controller.rb - About 1 hr to fix

          Function close has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  close: function () {
                      var s = this;
          
                      // prevent close when dialog does not exist
                      if (!s.d.data) {
          Severity: Minor
          Found in app/assets/javascripts/jquery.simplemodal-1.4.4.js - About 1 hr to fix

            Method create has 29 lines of code (exceeds 25 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

              Method add has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def add
                  if !@assessment.allow_student_assign_group && @cud.student?
                    flash[:error] = "You are not allowed to add members to your group for this assessment. "\
                      "Contact your instructor for group assignment."
                    redirect_to(action: :index) && return
              Severity: Minor
              Found in app/controllers/groups_controller.rb - About 1 hr to fix

                Method regradeAll has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def regradeAll
                    # Grab all of the submissions for this assessment
                    @submissions = @assessment.submissions.where(special_type: Submission::NORMAL)
                                   .order("version DESC")
                
                
                Severity: Minor
                Found in app/controllers/assessment/autograde.rb - About 1 hr to fix

                  Method run_scheduler has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def run_scheduler
                      current_time = Time.current
                      actions = Scheduler.where("next < ? AND ? <= until AND disabled is false", current_time,
                                                current_time)
                      actions.each do |action|
                  Severity: Minor
                  Found in app/controllers/application_controller.rb - About 1 hr to fix

                    Function PDFPageProxy_getOperatorList has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        getOperatorList: function PDFPageProxy_getOperatorList() {
                          function operatorListChanged() {
                            if (intentState.operatorList.lastChunk) {
                              intentState.opListReadCapability.resolve(intentState.operatorList);
                            }
                    Severity: Minor
                    Found in app/assets/javascripts/pdf.js - About 1 hr to fix

                      Function SVGExtraState has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        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

                        Function downloadSelected has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function downloadSelected(path) {
                            return new Promise(function(resolve, reject) {
                                $.ajax({
                                    url: '/file_manager/download_tar/',
                                    type: "POST",
                        Severity: Minor
                        Found in app/assets/javascripts/file_manager.js - About 1 hr to fix

                          Method index has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def index
                              # Instance variables that will be used by the view
                              @running_jobs = []   # running jobs
                              @waiting_jobs = []   # jobs waiting in job queue
                              @dead_jobs = []      # dead jobs culled from dead job queue
                          Severity: Minor
                          Found in app/controllers/jobs_controller.rb - About 1 hr to fix

                            Method regradeBatch has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def regradeBatch
                                submission_ids = params[:submission_ids]
                            
                                # Now regrade only the most recent submissions. Keep track of
                                # any handins that fail.
                            Severity: Minor
                            Found in app/controllers/assessment/autograde.rb - About 1 hr to fix

                              Method emitColSpec has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                def emitColSpec(colspec)
                                  return "Empty column specification" if colspec.blank?
                              
                                  begin
                                    # Quote JSON keys and values if they are not already quoted
                              Severity: Minor
                              Found in app/controllers/scoreboards_controller.rb - About 1 hr to fix

                                Method createScoreboardEntry has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  def createScoreboardEntry(scores, autoresult)
                                    # If the assessment was not autograded or the scoreboard was
                                    # not customized, then simply return the list of problem
                                    # scores and their total.
                                    if !autoresult ||
                                Severity: Minor
                                Found in app/controllers/scoreboards_controller.rb - About 1 hr to fix

                                  Method create has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    def create
                                      @attachment = if @is_assessment
                                                      @course.attachments.new(assessment_id: @assessment.id)
                                                    else
                                                      @course.attachments.new
                                  Severity: Minor
                                  Found in app/controllers/attachments_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 show has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    def show
                                      if @cud.instructor? || @attachment.released?
                                        begin
                                          attached_file = @attachment.attachment_file
                                          if attached_file.attached?
                                  Severity: Minor
                                  Found in app/controllers/attachments_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 load_dir_to_tar has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    def load_dir_to_tar(dir_path, asmt_dir, tar, filters = [], export_dir = "")
                                      Dir[File.join(dir_path, asmt_dir, "**")].each do |file|
                                        mode = File.stat(file).mode
                                        relative_path = file.sub(%r{^#{Regexp.escape dir_path}/?}, "")
                                        export_path = if export_dir == ""
                                  Severity: Minor
                                  Found in app/models/assessment.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 defaultFormatter has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    defaultFormatter: function(row, cell, value, columnDef, data) {
                                      user = data.email;
                                      asmt = columnDef.name;
                                  
                                      submission_status_key = columnDef.field + "_submission_status"
                                  Severity: Minor
                                  Found in app/assets/javascripts/gradebook.js - 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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language