expertiza/expertiza

View on GitHub

Showing 430 of 4,502 total issues

Method assign_reviewer_dynamically has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def assign_reviewer_dynamically
    assignment = Assignment.find(params[:assignment_id])
    participant = AssignmentParticipant.where(user_id: params[:reviewer_id], parent_id: assignment.id).first
    reviewer = participant.get_reviewer
    if params[:i_dont_care].nil? && params[:topic_id].nil? && assignment.topics? && assignment.can_choose_topic_to_review?
Severity: Minor
Found in app/controllers/review_mapping_controller.rb - About 1 hr to fix

    Function init has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        init:function(automodeperiod){
            var persistedtab=ddajaxtabs.getCookie(this.tabinterfaceid) //get position of persisted tab (applicable if persistence is enabled)
            var selectedtab=-1 //Currently selected tab index (-1 meaning none)
            var selectedtabfromurl=this.urlparamselect(this.tabinterfaceid) //returns null or index from: tabcontent.htm?tabinterfaceid=index
            this.automodeperiod=automodeperiod || 0
    Severity: Minor
    Found in app/assets/javascripts/ajaxtabs.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 import has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.import(row_hash, _session, assignment_id)
        reviewee_user_name = row_hash[:reviewee].to_s
        reviewee_user = User.find_by(name: reviewee_user_name)
        raise ArgumentError, 'Cannot find reviewee user.' unless reviewee_user
    
    
    Severity: Minor
    Found in app/models/review_response_map.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 get has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.get(sortvar = nil, sortorder = nil, user_id = nil, show = nil, parent_id = nil, _search = nil)
        conditions = if show
                       if User.find(user_id).role.name != 'Teaching Assistant'
                         'questionnaires.instructor_id = ?'
                       else
    Severity: Minor
    Found in app/models/questionnaire_node.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 get_next_due_date has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.get_next_due_date(assignment_id, topic_id = nil)
        if Assignment.find(assignment_id).staggered_deadline?
          next_due_date = TopicDueDate.find_by(['parent_id = ? and due_at >= ?', topic_id, Time.zone.now])
          # if certion TopicDueDate is not exist, we should query next corresponding AssignmentDueDate.
          # eg. Time.now is 08/28/2016
    Severity: Minor
    Found in app/models/due_date.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 get_user_list has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

      def get_user_list(username_search = '', fullname_search = '', email_search = '')
        # empty user_list[] created in order to store user list
    
        user_list = []
        # If super admin, then fetch and display all the users
    Severity: Minor
    Found in app/models/user.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 assign_reviewers_for_team has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

      def assign_reviewers_for_team(assignment_id, review_strategy, participants_hash)
        if ReviewResponseMap.where(reviewed_object_id: assignment_id, calibrate_to: 0)
                            .where('created_at > :time',
                                   time: @@time_create_last_review_mapping_record).size < review_strategy.reviews_needed
    
    
    Severity: Minor
    Found in app/controllers/review_mapping_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 compute_penalty_on_reviews has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

      def compute_penalty_on_reviews(review_mappings, review_due_date, num_of_reviews_required)
        review_map_created_at_list = []
        penalty = 0
        # Calculate the number of reviews that the user has completed so far.
        review_mappings.each do |map|
    Severity: Minor
    Found in app/helpers/penalty_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 penalties has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

      def penalties(assignment_id)
        @all_penalties = {}
        @assignment = Assignment.find(assignment_id)
        calculate_for_participants = true unless @assignment.is_penalty_calculated
        Participant.where(parent_id: assignment_id).each do |participant|
    Severity: Minor
    Found in app/helpers/grades_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 show has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

      def show
        @id = params[:id]
        @model = params[:model]
        @options = params[:options]
        @delimiter = get_delimiter(params)
    Severity: Minor
    Found in app/controllers/import_file_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 save_topic_deadlines has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

      def save_topic_deadlines
        assignment = Assignment.find(params[:assignment_id])
        @assignment_submission_due_dates = assignment.due_dates.select { |due_date| due_date.deadline_type_id == 1 }
        @assignment_review_due_dates = assignment.due_dates.select { |due_date| due_date.deadline_type_id == 2 }
        due_dates = params[:due_date]
    Severity: Minor
    Found in app/controllers/sign_up_sheet_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 update has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        update: function(value, duration) {
          if (value === true) {//Force update with current value
            this._setPercentage(this.getPercent());
            return this;
          }
    Severity: Minor
    Found in app/assets/javascripts/circles.js - About 1 hr to fix

      Method display_directory_tree has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def display_directory_tree(participant, files, display_to_reviewer_flag)
          index = 0
          participant = @participant if @participant
          assignment = participant.assignment # participant is @map.contributor
          topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id) # participant is @map.reviewer
      Severity: Minor
      Found in app/helpers/submitted_content_helper.rb - About 1 hr to fix

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

          def create
            @assignment_form = AssignmentForm.new(assignment_form_params)
            if params[:button]
              # E2138 issue #3
              find_existing_assignment = Assignment.find_by(name: @assignment_form.assignment.name, course_id: @assignment_form.assignment.course_id)
        Severity: Minor
        Found in app/controllers/assignments_controller.rb - About 1 hr to fix

          Method all_students_all_reviews has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def all_students_all_reviews
              course = Course.find(params[:course_id])
              @assignments = course.assignments.reject(&:is_calibrated).reject { |a| a.participants.empty? }
              @course_participants = course.get_participants
              insure_existence_of(@course_participants, course)
          Severity: Minor
          Found in app/controllers/assessment360_controller.rb - About 1 hr to fix

            Method calculate_score has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def calculate_score(map, response)
                questionnaire = Questionnaire.find(map.reviewed_object_id)
                scores = []
                valid = true
                questions = Question.where(questionnaire_id: questionnaire.id)
            Severity: Minor
            Found in app/controllers/student_quizzes_controller.rb - About 1 hr to fix

              Function SetHour has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

              function SetHour(intHour)
              {    
                  var MaxHour;
                  var MinHour;
                  if (TimeMode==24)
              Severity: Minor
              Found in app/assets/javascripts/datetimepicker.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

              Function alternate has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

              function alternate(id){
                if(document.getElementsByTagName){
                  var table = document.getElementById(id);
                  var rows = table.getElementsByTagName("tr");
                  var displayedRows = [];
              Severity: Minor
              Found in app/assets/javascripts/tableactions.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 update has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                def update(attributes, user, _vary_by_topic_desired = false)
                  @has_errors = false
                  has_late_policy = false
                  if attributes[:assignment][:late_policy_id].to_i > 0
                    has_late_policy = true
              Severity: Minor
              Found in app/models/assignment_form.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 review_response_report has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                def self.review_response_report(id, assignment, type, review_user)
                  if review_user.nil?
                    # This is not a search, so find all reviewers for this assignment
                    response_maps_with_distinct_participant_id =
                      ResponseMap.select('DISTINCT reviewer_id').where('reviewed_object_id = ? and type = ? and calibrate_to = ?', id, type, 0)
              Severity: Minor
              Found in app/models/review_response_map.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