expertiza/expertiza

View on GitHub

Showing 431 of 4,497 total issues

File response_analytic_spec.rb has 293 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class ResponseAnalyticTestDummyClass
  attr_accessor :scores
  require 'analytic/response_analytic'
  include ResponseAnalytic

Severity: Minor
Found in spec/models/response_analytic_spec.rb - About 3 hrs to fix

    Class Team has 26 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Team < ApplicationRecord
      has_many :teams_users, dependent: :destroy
      has_many :users, through: :teams_users
      has_many :join_team_requests, dependent: :destroy
      has_one :team_node, foreign_key: :node_object_id, dependent: :destroy
    Severity: Minor
    Found in app/models/team.rb - About 3 hrs to fix

      File scoring_spec.rb has 291 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      describe Scoring do
        include Scoring
        let(:assignment_helper) { Class.new { extend AssignmentHelper } }
        let(:questionnaire) { create(:questionnaire, id: 1) }
        let(:question1) { create(:question, questionnaire: questionnaire, weight: 1, id: 1) }
      Severity: Minor
      Found in spec/lib/scoring_spec.rb - About 3 hrs to fix

        File team_spec.rb has 291 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        describe Team do
          let(:assignment) { build(:assignment, id: 1, name: 'no assgt') }
          let(:participant) { build(:participant, user_id: 1) }
          let(:participant2) { build(:participant, user_id: 2) }
          let(:participant3) { build(:participant, user_id: 3) }
        Severity: Minor
        Found in spec/models/team_spec.rb - About 3 hrs to fix

          File teams_users_controller_spec.rb has 289 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require './spec/support/teams_shared.rb'
          
          describe TeamsUsersController do
            # Including the stubbed objects from the teams_shared.rb file
            include_context 'object initializations'
          Severity: Minor
          Found in spec/controllers/teams_users_controller_spec.rb - About 2 hrs to fix

            Method feedback_response_report has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

              def self.feedback_response_report(id, _type)
                # Example query
                # SELECT distinct reviewer_id FROM response_maps where type = 'FeedbackResponseMap' and
                # reviewed_object_id in (select id from responses where
                # map_id in (select id from response_maps where reviewed_object_id = 722 and type = 'ReviewResponseMap'))
            Severity: Minor
            Found in app/models/feedback_response_map.rb - About 2 hrs 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 toggleTeams has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

              function toggleTeams(numteams, visible) {
                  for (var i = 0; i < numteams; i++) {
                      var sublistsize = 1;
                      var elementId = 'team' + i;
                      var obj = document.getElementById(elementId + '_' + sublistsize);
            Severity: Minor
            Found in app/assets/javascripts/grading.js - About 2 hrs 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 NewCal has 72 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function NewCal(pCtrl,pFormat,pShowTime,pTimeMode)
            {
                Cal=new Calendar(dtToday);
                if ((pShowTime!=null) && (pShowTime))
                {
            Severity: Major
            Found in app/assets/javascripts/datetimepicker.js - About 2 hrs to fix

              Class StudentTask has 25 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class StudentTask
                attr_accessor :assignment, :current_stage, :participant, :stage_deadline, :topic
              
                def initialize(args)
                  @assignment = args[:assignment]
              Severity: Minor
              Found in app/models/student_task.rb - About 2 hrs to fix

                Class AssignmentParticipant has 25 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class AssignmentParticipant < Participant
                  belongs_to  :assignment, class_name: 'Assignment', foreign_key: 'parent_id'
                  has_many    :review_mappings, class_name: 'ReviewResponseMap', foreign_key: 'reviewee_id'
                  has_many    :response_maps, foreign_key: 'reviewee_id'
                  has_many    :quiz_mappings, class_name: 'QuizResponseMap', foreign_key: 'reviewee_id'
                Severity: Minor
                Found in app/models/assignment_participant.rb - About 2 hrs to fix

                  Function toggleList has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function toggleList(elementId,listSize) {
                    if (listSize == 0) {return;}        
                    for (var i = 1; i <= listSize; i++){
                      var obj = document.getElementById(elementId+"_"+i);
                      if (obj == null) { return; }
                  Severity: Minor
                  Found in app/assets/javascripts/tableactions.js - About 2 hrs 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 items_for_permissions has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def self.items_for_permissions(permission_ids = nil)
                      if permission_ids
                        perms = {}
                        permission_ids.each { |id| perms[id] = true }
                      end
                  Severity: Minor
                  Found in app/models/menu_item.rb - About 2 hrs 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 three_node_cycles has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def three_node_cycles(assignment_participant)
                      collusion_cycles = []
                      assignment_participant.reviewers.each do |ap1|
                        ap1.reviewers.each do |ap2|
                          next unless ap2.reviewers.include?(assignment_participant)
                  Severity: Minor
                  Found in app/models/collusion_cycle.rb - About 2 hrs 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 hash_rows_with_headers has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def hash_rows_with_headers(header, body)
                      new_body = []
                      if (params[:model] == 'User') || (params[:model] == 'AssignmentParticipant') || (params[:model] == 'CourseParticipant') || (params[:model] == 'SignUpTopic')
                        header.map! { |str| str.strip.downcase.gsub(/\s+/, "").to_sym }
                        body.each do |row|
                  Severity: Minor
                  Found in app/controllers/import_file_controller.rb - About 2 hrs 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

                  Class ReputationWebServiceController has 24 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  class ReputationWebServiceController < ApplicationController
                    include AuthorizationHelper
                  
                    # Method: action_allowed
                    # This method checks if the currently authenticated user has the authorization
                  Severity: Minor
                  Found in app/controllers/reputation_web_service_controller.rb - About 2 hrs to fix

                    Class ApplicationController has 24 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    class ApplicationController < ActionController::Base
                      include AccessHelper
                    
                      # You want to get exceptions in development, but not in production.
                      unless Rails.application.config.consider_all_requests_local
                    Severity: Minor
                    Found in app/controllers/application_controller.rb - About 2 hrs to fix

                      Class ResponseController has 24 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      class ResponseController < ApplicationController
                        include AuthorizationHelper
                        include ResponseHelper
                      
                        helper :submitted_content
                      Severity: Minor
                      Found in app/controllers/response_controller.rb - About 2 hrs to fix

                        File assignment_participant_spec.rb has 276 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        describe AssignmentParticipant do
                          let(:response) { build(:response) }
                          let(:team) { build(:assignment_team, id: 1) }
                          let(:team2) { build(:assignment_team, id: 2) }
                          let(:response_map) { build(:review_response_map, reviewer_id: 2, response: [response]) }
                        Severity: Minor
                        Found in spec/models/assignment_participant_spec.rb - About 2 hrs to fix

                          Function dateFormat has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          var dateFormat = function () {
                            var    token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,
                                timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
                                timezoneClip = /[^-+\dA-Z]/g,
                                pad = function (val, len) {
                          Severity: Major
                          Found in app/assets/javascripts/application.js - About 2 hrs to fix

                            Method update_due_dates has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def update_due_dates(attributes, user)
                                return false unless attributes
                            
                                attributes.each do |due_date|
                                  next if due_date[:due_at].blank?
                            Severity: Minor
                            Found in app/models/assignment_form.rb - About 2 hrs 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