expertiza/expertiza

View on GitHub

Showing 430 of 4,506 total issues

Avoid too many return statements within this function.
Open

          return a_val.localeCompare(b_val)
Severity: Major
Found in app/assets/javascripts/tree_display.jsx - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return (this.toUTCString());
    Severity: Major
    Found in app/assets/javascripts/datetimepicker.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return -1
      Severity: Major
      Found in app/assets/javascripts/tree_display.jsx - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

              return nil
        Severity: Major
        Found in app/models/team.rb - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return 1
          Severity: Major
          Found in app/assets/javascripts/tree_display.jsx - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                  return name
            Severity: Major
            Found in app/models/team.rb - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return 0
              Severity: Major
              Found in app/assets/javascripts/tree_display.jsx - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return (this.GetMonthName(false)+DateSeparator+pDate+DateSeparator+this.Year);
                Severity: Major
                Found in app/assets/javascripts/datetimepicker.js - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return aq if aq.questionnaire_id && Questionnaire.find(aq.questionnaire_id).type == questionnaire_type
                  Severity: Major
                  Found in app/models/assignment_form.rb - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                        return unless team_member_added
                    Severity: Major
                    Found in app/models/mentor_management.rb - About 30 mins to fix

                      Method system_pages has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def system_pages(pageid)
                          pages = []
                      
                          pages << 'Site default page' if site_default_page_id == pageid
                          pages << 'Not found page' if not_found_page_id == pageid
                      Severity: Minor
                      Found in app/models/system_settings.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_user_list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def self.get_user_list(user)
                          courses = Ta.get_mapped_courses(user.id)
                          participants = []
                          user_list = []
                          courses.each do |course_id|
                      Severity: Minor
                      Found in app/models/ta.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_number_of_taggable_answers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def get_number_of_taggable_answers(user_id)
                          team = Team.joins(:teams_users).where(team_users: { parent_id: assignment_id }, user_id: user_id)
                          responses = Response.joins(:response_maps).where(response_maps: { reviewed_object_id: assignment.id, reviewee_id: team.id })
                          questions = Question.where(questionnaire_id: questionnaire.id, type: question_type)
                      
                      
                      Severity: Minor
                      Found in app/models/tag_prompt_deployment.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 remove_from_waitlists has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def self.remove_from_waitlists(team_id)
                              signups = SignedUpTeam.where(team_id: team_id)
                              signups.each do |signup|
                                  signup_topic_id = signup.topic_id
                                  signup.destroy
                      Severity: Minor
                      Found in app/models/waitlist.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 force_delete has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def force_delete(maps)
                          maps && maps.each(&:destroy)
                          if team && (team.teams_users.length == 1)
                            team.delete
                          elsif team
                      Severity: Minor
                      Found in app/models/participant.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_responses_for_team_round has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def self.get_responses_for_team_round(team, round)
                          responses = []
                          if team.id
                            maps = ResponseMap.where(reviewee_id: team.id, type: 'ReviewResponseMap')
                            maps.each do |map|
                      Severity: Minor
                      Found in app/models/review_response_map.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 team_id has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def self.team_id(assignment_id, user_id)
                          # team_id variable represents the team_id for this user in this assignment
                          team_id = nil
                          teams_users = TeamsUser.where(user_id: user_id)
                          teams_users.each do |teams_user|
                      Severity: Minor
                      Found in app/models/teams_user.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

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

                      function toggleElement(elementId, linkText) {    
                        var obj = document.getElementById(elementId);
                        if (obj == null) { return; }    
                        var bExpand = obj.style.display.length == 0;
                        obj.style.display = (bExpand ? 'none' : '');           
                      Severity: Minor
                      Found in app/assets/javascripts/tableactions.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

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

                      function onMetricToggle(clicked_metric) {
                          if (clicked_metric.checked == true) {
                              var hide = false
                          } else {
                              var hide = true
                      Severity: Minor
                      Found in app/assets/javascripts/view_team_in_grades.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 update_assigned_badges has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def update_assigned_badges(badge, assignment)
                          if assignment && badge
                            AssignmentBadge.where(assignment_id: assignment[:id]).map(&:id).each do |assigned_badge_id|
                              AssignmentBadge.delete(assigned_badge_id) unless badge[:id].include?(assigned_badge_id)
                            end
                      Severity: Minor
                      Found in app/models/assignment_form.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