expertiza/expertiza

View on GitHub

Showing 430 of 4,502 total issues

Method view_copyright_grants has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def view_copyright_grants
    assignment_id = params[:id]
    assignment = Assignment.find(assignment_id)
    @assignment_name = assignment.name
    @has_topics = false
Severity: Minor
Found in app/controllers/participants_controller.rb - About 45 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 locale_for_student has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def locale_for_student
    # Gets participant using student from params
    participant_id = params[:id] || params[:student_id]
    if !participant_id.nil?
      participant = AssignmentParticipant.find_by(id: participant_id)
Severity: Minor
Found in app/controllers/application_controller.rb - About 45 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 duplicate_name_check has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def duplicate_name_check(is_update = false)
    should_check = true
    prefix = is_update ? "Cannot edit the policy. " : ""
    valid_penalty, error_message = true, nil

Severity: Minor
Found in app/controllers/late_policies_controller.rb - About 45 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

Avoid deeply nested control flow statements.
Open

    elsif params[:model] == 'AssignmentParticipant' || params[:model] == 'CourseParticipant'
      contents_hash = eval(params[:contents_hash])
      if params[:has_header] == 'true'
        @header_integrated_body = hash_rows_with_headers(contents_hash[:header], contents_hash[:body])
      else
Severity: Major
Found in app/controllers/import_file_controller.rb - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

          if params[:has_header] == 'true'
            @header_integrated_body = hash_rows_with_headers(contents_hash[:header], contents_hash[:body])
          else
            if params[:optional_count] == '0'
              new_header = [params[:select1], params[:select2], params[:select3]]
    Severity: Major
    Found in app/controllers/import_file_controller.rb - About 45 mins to fix

      Method set_priority has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def set_priority
          participant = AssignmentParticipant.find_by(id: params[:participant_id])
          assignment_id = SignUpTopic.find(params[:topic].first).assignment.id
          team_id = participant.team.try(:id)
          unless team_id
      Severity: Minor
      Found in app/controllers/sign_up_sheet_controller.rb - About 45 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

      Avoid deeply nested control flow statements.
      Open

            rescue StandardError
              errors << $ERROR_INFO
      Severity: Major
      Found in app/controllers/import_file_controller.rb - About 45 mins to fix

        Method set_current_role has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.set_current_role(role_id, session)
            if role_id
              role = Role.find(role_id)
              if role
                Role.rebuild_cache if !role.cache || !role.cache.try(:has_key?, :credentials)
        Severity: Minor
        Found in app/controllers/auth_controller.rb - About 45 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 update_participants_reputation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def update_participants_reputation(reputation_response)
            JSON.parse(reputation_response.body.to_s).each do |reputation_algorithm, user_resputation_list|
              next unless %w[Hamer Lauw].include?(reputation_algorithm)
        
              user_resputation_list.each do |user_id, reputation|
        Severity: Minor
        Found in app/controllers/reputation_web_service_controller.rb - About 45 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_peer_reviews has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def get_peer_reviews(assignment_id_list, round_num, has_topic)
            raw_data_array = []
            ReviewResponseMap.where('reviewed_object_id in (?) and calibrate_to = ?', assignment_id_list, false).each do |response_map|
              reviewer = response_map.reviewer.user
              team = AssignmentTeam.find(response_map.reviewee_id)
        Severity: Minor
        Found in app/controllers/reputation_web_service_controller.rb - About 45 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 update has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def update
            # Flash an error if neither an action nor a page has been selected
            if params[:menu_item][:controller_action_id].blank? &&
               params[:menu_item][:content_page_id].blank?
              flash[:error] = 'You must specify either an action or a page!'
        Severity: Minor
        Found in app/controllers/menu_items_controller.rb - About 45 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 folder_action has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def folder_action
            @participant = AssignmentParticipant.find(params[:id])
            return unless current_user_id?(@participant.user_id)
        
            @current_folder = DisplayOption.new
        Severity: Minor
        Found in app/controllers/submitted_content_controller.rb - About 45 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_email has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def send_email
            subject = params['send_email']['subject']
            body = params['send_email']['email_body']
            participant_id = params['participant_id']
            assignment_id = params['assignment_id']
        Severity: Minor
        Found in app/controllers/student_task_controller.rb - About 45 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 create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def create
            map_id = params[:id]
            unless params[:map_id].nil?
              map_id = params[:map_id]
            end # pass map_id as a hidden field in the review form
        Severity: Minor
        Found in app/controllers/response_controller.rb - About 45 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

        Consider simplifying this complex logical expression.
        Open

            if(val1 == val2 || val1 == val3 || val1 == val4 || val2 == val3 || val2 == val4 || val3 == val4) {
                alert("No two columns can have same value.")
            } else {
                column_form.submit();
            }
        Severity: Major
        Found in app/assets/javascripts/shared.js - About 40 mins to fix

          Method get_children has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def get_children(_sortvar = nil, _sortorder = nil, _user_id = nil, _parent_id = nil, _search = nil)
          Severity: Minor
          Found in app/models/team_node.rb - About 35 mins to fix

            Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              def initialize(question_text, question_id, weight, question_max_score, seq)
            Severity: Minor
            Found in app/models/vm_question_response_row.rb - About 35 mins to fix

              Method handle_duplicate has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                def self.handle_duplicate(team, name, id, handle_dups, teamtype)
              Severity: Minor
              Found in app/models/team.rb - About 35 mins to fix

                Method complete has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  def complete(count, answer = nil, questionnaire_min, questionnaire_max, dropdown_or_scale)
                Severity: Minor
                Found in app/models/criterion.rb - About 35 mins to fix

                  Method display_as_html has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    def display_as_html(prefix = nil, count = nil, _file_url = nil, show_tags = nil, current_user = nil)
                  Severity: Minor
                  Found in app/models/response.rb - About 35 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language