autolab/Autolab

View on GitHub

Showing 419 of 572 total issues

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 update_config has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def update_config
    required_params = %w[iss developer_key auth_url oauth2_access_token_url]
    required_params.each do |param|
      if params[param].blank?
        flash[:error] = "#{param} field was missing"
Severity: Minor
Found in app/controllers/lti_config_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 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

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

  def set_submission
    begin
      @submission = @assessment.submissions.find(params[:submission_id] || params[:id])
    rescue StandardError
      flash[:error] = "Could not find submission with id #{params[:submission_id] || params[:id]}."
Severity: Minor
Found in app/controllers/application_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 upload has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def upload
    uploaded_makefile = params[:autograder][:makefile]
    uploaded_tar = params[:autograder][:tar]
    unless uploaded_makefile.nil?
      File.open(Rails.root.join("courses", @course.name, @assessment.name, "autograde-Makefile"),
Severity: Minor
Found in app/controllers/autograders_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 regradeAll has a Cognitive Complexity of 10 (exceeds 5 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

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 regradeBatch has a Cognitive Complexity of 10 (exceeds 5 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

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_paintImageMaskXObject has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    paintImageMaskXObject: function CanvasGraphics_paintImageMaskXObject(img) {
      var ctx = this.ctx;
      var width = img.width, height = img.height;
      var fillColor = this.current.fillColor;
      var isPatternFill = this.current.patternFill;
Severity: Minor
Found in app/assets/javascripts/pdf.js - About 1 hr to fix

    Function SVGGraphics_setFont has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        setFont: function SVGGraphics_setFont(details) {
          var current = this.current;
          var fontObj = this.commonObjs.get(details[0]);
          var size = details[1];
          this.current.font = fontObj;
    Severity: Minor
    Found in app/assets/javascripts/pdf.js - About 1 hr to fix

      Function asyncPostProcessRows has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function asyncPostProcessRows() {
            while (postProcessFromRow <= postProcessToRow) {
              var row = (vScrollDir >= 0) ? postProcessFromRow++ : postProcessToRow--;
              var cacheEntry = rowsCache[row];
              if (!cacheEntry || row >= getDataLength()) {
      Severity: Minor
      Found in app/assets/javascripts/SlickGrid/2.02/slick.grid.js - About 1 hr to fix

        Function get_brush_interval has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function get_brush_interval(args) {
            var resolution = args.brushing_interval,
                interval;
        
            if (!resolution) {
        Severity: Minor
        Found in app/assets/javascripts/metricsgraphics_brushing.js - About 1 hr to fix

          Method stats_table has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def stats_table(data)
              out =
              '<table class="striped">
                 <thead>
                   <tr class="red darken-3 white-text">
          Severity: Minor
          Found in app/helpers/assessment_helper.rb - About 1 hr to fix

            Method send_test_email has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def send_test_email
                required_params = %w[protocol host address port authentication communication_protocol to_email
                                     from_email default_from]
            
                # Create temp file to save the new configuration
            Severity: Minor
            Found in app/controllers/smtp_config_controller.rb - About 1 hr to fix

              Function search_enter_action has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function search_enter_action(query, tab_name, instances, archived_instances, empty_message, selected_user_ids) {
                var search_input = query.toLowerCase().trim();
                if (search_input === "") {
                  set_tab_html(
                    true,
              Severity: Minor
              Found in app/assets/javascripts/watchlist.js - About 1 hr to fix

                Function scrollPage has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function scrollPage(dir) {
                      var deltaRows = dir * numVisibleRows;
                      scrollTo((getRowFromPosition(scrollTop) + deltaRows) * options.rowHeight);
                      render();
                
                Severity: Minor
                Found in app/assets/javascripts/SlickGrid/2.02/slick.grid.js - About 1 hr to fix

                  Function cleanUpCells has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function cleanUpCells(range, row) {
                        var totalCellsRemoved = 0;
                        var cacheEntry = rowsCache[row];
                  
                        // Remove cells outside the range.
                  Severity: Minor
                  Found in app/assets/javascripts/SlickGrid/2.02/slick.grid.js - About 1 hr to fix

                    Function Range has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      function Range(fromRow, fromCell, toRow, toCell) {
                        if (toRow === undefined && toCell === undefined) {
                          toRow = fromRow;
                          toCell = fromCell;
                        }
                    Severity: Minor
                    Found in app/assets/javascripts/SlickGrid/2.02/slick.core.js - About 1 hr to fix

                      Function compileFilterWithCaching has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function compileFilterWithCaching() {
                            var filterInfo = getFunctionInfo(filter);
                      
                            var filterBody = filterInfo.body
                                .replace(/return false[;}]/gi, "{ continue _coreloop; }")
                      Severity: Minor
                      Found in app/assets/javascripts/SlickGrid/2.02/slick.dataview.js - About 1 hr to fix

                        Function putBinaryImageMask has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          function putBinaryImageMask(ctx, imgData) {
                            var height = imgData.height, width = imgData.width;
                            var partialChunkHeight = height % FULL_CHUNK_HEIGHT;
                            var fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT;
                            var totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1;
                        Severity: Minor
                        Found in app/assets/javascripts/pdf.js - About 1 hr to fix

                          Function Metadata_parse has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              parse: function Metadata_parse() {
                                var doc = this.metaDocument;
                                var rdf = doc.documentElement;
                          
                                if (rdf.nodeName.toLowerCase() !== 'rdf:rdf') { // Wrapped in <xmpmeta>
                          Severity: Minor
                          Found in app/assets/javascripts/pdf.js - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language