autolab/Autolab

View on GitHub

Showing 419 of 572 total issues

Method create has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

    Method handout has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def handout
        # If the logic here changes, do update assessment#has_handout?
        begin
          extend_config_module(@assessment, nil, @cud)
        rescue StandardError => e
    Severity: Minor
    Found in app/controllers/assessment/handout.rb - About 1 hr to fix

      Function fontLoaderBind has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        bind: function fontLoaderBind(fonts, callback) {
          assert(!isWorker, 'bind() shall be called from main thread');
      
          var rules = [];
          var fontsToLoad = [];
      Severity: Minor
      Found in app/assets/javascripts/pdf.js - About 1 hr to fix

        Function Uint32ArrayViewClosure has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var Uint32ArrayView = (function Uint32ArrayViewClosure() {
        
          function Uint32ArrayView(buffer, length) {
            this.buffer = buffer;
            this.byteLength = buffer.length;
        Severity: Minor
        Found in app/assets/javascripts/pdf.js - About 1 hr to fix

          Function setActiveCellInternal has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function setActiveCellInternal(newCell, opt_editMode) {
                if (activeCellNode !== null) {
                  makeActiveCellNormal();
                  $(activeCellNode).removeClass("active");
                  if (rowsCache[activeRow]) {
          Severity: Minor
          Found in app/assets/javascripts/SlickGrid/2.02/slick.grid.js - About 1 hr to fix

            Function appendRowHtml has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function appendRowHtml(stringArray, row, range, dataLength) {
                  var d = getDataItem(row);
                  var dataLoading = row < dataLength && !d;
                  var rowCss = "slick-row" +
                      (dataLoading ? " loading" : "") +
            Severity: Minor
            Found in app/assets/javascripts/SlickGrid/2.02/slick.grid.js - About 1 hr to fix

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

                def index
                  path = params[:path].nil? ? "" : params[:path]
                  new_url = "#{path}/"
                  parts = new_url.split('/')
                  if parts.empty?
              Severity: Minor
              Found in app/controllers/file_manager_controller.rb - About 1 hr to fix

                Method statistics has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def statistics
                    load_course_config
                    latest_submissions = @assessment.submissions.latest_for_statistics.includes(:scores, :course_user_datum)
                    #latest_submissions = @assessment.submissions.latest.includes(:scores, :course_user_datum)
                
                
                Severity: Minor
                Found in app/controllers/assessment/grading.rb - About 1 hr to fix

                  Function CanvasGraphics_setFont has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      setFont: function CanvasGraphics_setFont(fontRefName, size) {
                        var fontObj = this.commonObjs.get(fontRefName);
                        var current = this.current;
                  
                        if (!fontObj) {
                  Severity: Minor
                  Found in app/assets/javascripts/pdf.js - About 1 hr to fix

                    Function setupColumnReorder has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        function setupColumnReorder() {
                          $headers.filter(":ui-sortable").sortable("destroy");
                          $headers.sortable({
                            containment: "parent",
                            distance: 3,
                    Severity: Minor
                    Found in app/assets/javascripts/SlickGrid/2.02/slick.grid.js - About 1 hr to fix

                      Function syncGridCellCssStyles has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function syncGridCellCssStyles(grid, key) {
                            var hashById;
                            var inHandler;
                      
                            // since this method can be called after the cell styles have been set,
                      Severity: Minor
                      Found in app/assets/javascripts/SlickGrid/2.02/slick.dataview.js - About 1 hr to fix

                        Function renderRows has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            function renderRows(range) {
                              var parentNode = $canvas[0],
                                  stringArray = [],
                                  rows = [],
                                  needToReselectCell = false,
                        Severity: Minor
                        Found in app/assets/javascripts/SlickGrid/2.02/slick.grid.js - About 1 hr to fix

                          Function runHandlers has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              runHandlers: function runHandlers() {
                                var RUN_TIMEOUT = 1; // ms
                                var timeoutAt = Date.now() + RUN_TIMEOUT;
                                while (this.handlers.length > 0) {
                                  var handler = this.handlers.shift();
                          Severity: Minor
                          Found in app/assets/javascripts/pdf.js - About 1 hr to fix

                            Function CanvasGraphics_fill has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                fill: function CanvasGraphics_fill(consumePath) {
                                  consumePath = typeof consumePath !== 'undefined' ? consumePath : true;
                                  var ctx = this.ctx;
                                  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 gotoPrev has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  function gotoPrev(row, cell, posX) {
                                    if (row == null && cell == null) {
                                      row = getDataLengthIncludingAddNew() - 1;
                                      cell = posX = columns.length - 1;
                                      if (canCellBeActive(row, cell)) {
                              Severity: Minor
                              Found in app/assets/javascripts/SlickGrid/2.02/slick.grid.js - About 1 hr to fix

                                Function buttons has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                                buttons : function(settings, original) {
                                                    var form = this;
                                                    if (settings.submit) {
                                                        /* if given html string use that */
                                                        if (settings.submit.match(/>$/)) {
                                Severity: Minor
                                Found in app/assets/javascripts/jquery.jeditable.js - About 1 hr to fix

                                  Method sendJob_batch has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    def sendJob_batch(course, assessment, submissions, cud)
                                      failed_list = []
                                  
                                      submissions.each do |submission|
                                        if submission
                                  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 computed_score has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    def computed_score(link = nil, nil_to_dash = true)
                                      value = yield
                                      value = value ? value.round(1) : value
                                      nil_to_dash && (value.nil?) ? raw("&ndash;") : value
                                    rescue ScoreComputationException => e
                                  Severity: Minor
                                  Found in app/helpers/application_helper.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 google_oauth2 has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    def google_oauth2
                                      if user_signed_in?
                                        if (data = request.env["omniauth.auth"]) && current_user.authentications.where(provider: data["provider"],
                                                                                                                       uid: data["uid"]).empty?
                                          current_user.authentications.create(provider: data["provider"],
                                  Severity: Minor
                                  Found in app/controllers/users/omniauth_callbacks_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 student has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    def student
                                      @_cud = if params[:id]
                                                CourseUserDatum.find_by(id: params[:id])
                                              else
                                                @cud
                                  Severity: Minor
                                  Found in app/controllers/gradebooks_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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language