autolab/Autolab

View on GitHub

Showing 419 of 572 total issues

Avoid too many return statements within this method.
Open

    return unless (invalid_cud || nicknameless_student) && !in_edit_or_unsudo
Severity: Major
Found in app/controllers/application_controller.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

          redirect_to([:users, @course]) && return
    Severity: Major
    Found in app/controllers/lti_nrps_controller.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                         status: :bad_request) && return
      Severity: Major
      Found in app/controllers/assessment/handin.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

            return unless @scoreboard.colspec.present?
        Severity: Major
        Found in app/controllers/scoreboards_controller.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                    render(plain: "WARNING: could not clear previous handin directory, please") && return
          Severity: Major
          Found in app/controllers/assessment/handin.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                  return
            Severity: Major
            Found in app/controllers/assessment/handout.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      render(plain: flash[:error], status: :bad_request) && return unless validateHandinForGroups_forHTML
              Severity: Major
              Found in app/controllers/assessment/handin.rb - About 30 mins to fix

                Function updateButtonVisibility has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                function updateButtonVisibility(item){
                  // Deleting instances only avilable in archive tab
                  showTopButtons(true, true, true, false, true);
                  switch ($(item).attr("data-tab")) {
                    case "pending_tab":
                Severity: Minor
                Found in app/assets/javascripts/watchlist.js - About 25 mins 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_config_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def load_config_file
                    # read from source
                    config_source = File.open(unique_source_config_file_path, "r", &:read)
                
                    # validate syntax of config
                Severity: Minor
                Found in app/models/assessment.rb - About 25 mins 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 check_box has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def check_box(name, *args)
                    options = args.extract_options!
                
                    display_name = options[:display_name].nil? ? name : options[:display_name]
                
                Severity: Minor
                Found in app/form_builders/form_builder_with_date_time_input.rb - About 25 mins 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 get_callback_url has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def get_callback_url(course, assessment, submission, dave)
                    # Use https, unless explicitly specified not to
                    prefix = "https://"
                    if ENV["DOCKER_SSL"] == "false"
                      prefix = "http://"
                Severity: Minor
                Found in app/helpers/assessment_autograde_core.rb - About 25 mins 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_status has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def tango_status
                    # Obtain overall Tango info and pool status
                    @tango_info = TangoClient.info
                    @vm_pool_list = TangoClient.pool
                    # Obtain Image -> Course mapping
                Severity: Minor
                Found in app/controllers/jobs_controller.rb - About 25 mins 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 validateHandin has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def validateHandin(size, content_type, filename)
                    # Make sure that handins are allowed
                    if @assessment.disable_handins?
                      return :handin_disabled
                    end
                Severity: Minor
                Found in app/helpers/assessment_handin_core.rb - About 25 mins 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 send_test_email has a Cognitive Complexity of 6 (exceeds 5 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 25 mins 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_course has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def set_course
                    course_name = params[:course_name] ||
                                  (params[:controller] == "courses" ? params[:name] : nil)
                    @course = Course.find_by(name: course_name) if course_name
                
                
                Severity: Minor
                Found in app/controllers/api/v1/base_api_controller.rb - About 25 mins 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 recoverHierarchy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def self.recoverHierarchy(files, root)
                    depth = root[:pathname].chomp("/").count "/"
                    if(root[:pathname] == "")
                      depth = -1
                    end
                Severity: Minor
                Found in lib/archive.rb - About 25 mins 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 index has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def index
                    unless @cud.instructor
                      aud = @assessment.aud_for @cud.id
                      if aud.group
                        redirect_to(course_assessment_group_path(@course, @assessment, aud.group)) && return
                Severity: Minor
                Found in app/controllers/groups_controller.rb - About 25 mins 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 require_privilege has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def require_privilege(scope)
                    # check if client has the required scope
                    doorkeeper_authorize! scope
                    return if performed?
                
                
                Severity: Minor
                Found in app/controllers/api/v1/base_api_controller.rb - About 25 mins 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 maintenance_mode? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def maintenance_mode?
                    # enable/disable maintenance mode with this switch:
                    return unless ENV["AUTOLAB_MAINTENANCE"]
                    render(:maintenance) && return unless user_signed_in? && current_user.administrator?
                  end
                Severity: Minor
                Found in app/controllers/application_controller.rb - About 25 mins 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