Cloud-CV/EvalAI

View on GitHub

Showing 666 of 1,371 total issues

Avoid deeply nested control flow statements.
Open

                                                        if (vm.existTeam.previous === null) {
                                                            vm.isPrev = 'disabled';
                                                        } else {
                                                            vm.isPrev = '';
                                                        }
Severity: Major
Found in frontend/src/js/controllers/challengeCtrl.js - About 45 mins to fix

    Function runFunc has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        function runFunc($rootScope, $state, utilities, $window, $location, toaster) {
    Severity: Minor
    Found in frontend/src/js/route-config/route-config.js - About 45 mins to fix

      Function scale_up_workers has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def scale_up_workers(challenge, original_desired_size, pending_submissions, evalai_interface, aws_keys, new_desired_size):
      Severity: Minor
      Found in scripts/monitoring/auto_scale_eks_nodes.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                else if (duration._data.hours !=0) {
                                    var hours = duration.asHours();
                                    vm.leaderboard[i].submission__submitted_at = hours;
                                    if (hours.toFixed(0)==1) {
                                        vm.leaderboard[i].timeSpan = 'hour';
        Severity: Major
        Found in frontend/src/js/controllers/featuredChallengeCtrl.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                                      for(var i=0; i<challengePhaseId.length; i++) {
                                                          if (challengePhaseId[i] == response.data.challenge_phase) {
                                                              vm.lastSubmissionTime[challengePhaseId[i]] = details.last_submission_timestamp_in_challenge_phase;
                                                              i++;
                                                              break;
          Severity: Major
          Found in frontend/src/js/controllers/analyticsCtrl.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                        if (days.toFixed(0)==1) {
                                            vm.leaderboard[i].timeSpan = 'day';
                                        } else {
                                            vm.leaderboard[i].timeSpan = 'days';
                                        }
            Severity: Major
            Found in frontend/src/js/controllers/featuredChallengeCtrl.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                          if (days.toFixed(0) == 1) {
                                              vm.leaderboard[i].timeSpan = 'day';
                                          } else {
                                              vm.leaderboard[i].timeSpan = 'days';
                                          }
              Severity: Major
              Found in frontend/src/js/controllers/challengeCtrl.js - About 45 mins to fix

                Function scale_up_or_down_workers_for_challenge has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                def scale_up_or_down_workers_for_challenge(challenge, challenge_metrics):
                    if ENV == "prod":
                        try:
                            if challenge["remote_evaluation"] is False:
                                scale_up_or_down_workers(challenge, challenge_metrics)
                Severity: Minor
                Found in scripts/monitoring/auto_scale_workers.py - 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

                Function profileCtrl has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    function profileCtrl(utilities, $rootScope, $scope, $mdDialog, moment, $state) {
                Severity: Minor
                Found in frontend/src/js/controllers/profileCtrl.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          else if (duration._data.hours !=0) {
                                              var hours = duration.asHours();
                                              vm.leaderboard[i].submission__submitted_at = hours;
                                              if (hours.toFixed(0)==1) {
                                                  vm.leaderboard[i].timeSpan = 'hour';
                  Severity: Major
                  Found in frontend/src/js/controllers/challengeCtrl.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            } else if (duration._data.hours != 0) {
                                                var hours = duration.asHours();
                                                vm.leaderboard[i].submission__submitted_at = hours;
                                                if (hours.toFixed(0) == 1) {
                                                    vm.leaderboard[i].timeSpan = 'hour';
                    Severity: Major
                    Found in frontend/src/js/controllers/challengeCtrl.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                                                  for(var i=0; i<challengePhaseId.length; i++) {
                                                                      if (challengePhaseId[i] == details.challenge_phase) {
                                                                          vm.totalSubmission[challengePhaseId[i]] = details.total_submissions;
                                                                          vm.totalParticipatedTeams[challengePhaseId[i]] = details.participant_team_count;
                                                                          i++;
                      Severity: Major
                      Found in frontend/src/js/controllers/analyticsCtrl.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            if pods_list and pods_list.items[0].status.container_statuses:
                                                # Update submission to running
                                                submission_data = {
                                                    "submission_status": "running",
                                                    "submission": submission_pk,
                        Severity: Major
                        Found in scripts/workers/code_upload_submission_worker.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  if job_name:
                                                      latest_job_name = job_name[-1]
                                                      delete_job(api_instance, latest_job_name)
                                                  else:
                                                      logger.info(
                          Severity: Major
                          Found in scripts/workers/code_upload_submission_worker.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                if metric not in leaderboard_metrics:
                                                    missing_metrics.append(metric)
                            
                            
                            Severity: Major
                            Found in apps/jobs/views.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                  for domain in challenge.allowed_email_domains:
                                                      domains = "{}{}{}".format(domains, "/", domain)
                                                  domains = domains[1:]
                              Severity: Major
                              Found in apps/participants/views.py - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                    if metric not in leaderboard_metrics:
                                                        missing_metrics.append(metric)
                                
                                
                                Severity: Major
                                Found in apps/jobs/views.py - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                      if not (
                                                          isinstance(value, float) or isinstance(value, int)
                                                      ):
                                                          malformed_metrics.append((metric, type(value)))
                                  
                                  
                                  Severity: Major
                                  Found in apps/jobs/views.py - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                            if container_name in ["agent", "submission", "environment"]:
                                                                if container_state.terminated is not None:
                                                                    pod_name = pods_list.items[0].metadata.name
                                                                    try:
                                                                        pod_log_response = core_v1_api_instance.read_namespaced_pod_log(
                                    Severity: Major
                                    Found in scripts/workers/code_upload_submission_worker.py - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                          if (
                                                              current_running_submissions_count
                                                              == maximum_concurrent_submissions
                                                          ):
                                                              pass
                                      Severity: Major
                                      Found in scripts/workers/submission_worker.py - About 45 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language