Cloud-CV/EvalAI

View on GitHub

Showing 666 of 1,371 total issues

Function challenge_submission has a Cognitive Complexity of 75 (exceeds 5 allowed). Consider refactoring.
Open

def challenge_submission(request, challenge_id, challenge_phase_id):
    """API Endpoint for making a submission to a challenge"""

    # check if the challenge exists or not
    try:
Severity: Minor
Found in apps/jobs/views.py - About 1 day 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

File models.py has 608 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from __future__ import unicode_literals

from django.contrib.auth.models import User
from django.core import serializers
from django.db.models.signals import pre_save
Severity: Major
Found in apps/challenges/models.py - About 1 day to fix

    File utils.py has 541 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import os
    import json
    import logging
    import random
    import string
    Severity: Major
    Found in apps/challenges/utils.py - About 1 day to fix

      Function AnalyticsCtrl has 224 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function AnalyticsCtrl(utilities, $state, $rootScope) {
              var vm = this;
      
              vm.hostTeam = {};
              vm.teamId = null;
      Severity: Major
      Found in frontend/src/js/controllers/analyticsCtrl.js - About 1 day to fix

        File serializers.py has 529 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        from rest_framework import serializers
        
        from accounts.serializers import UserDetailsSerializer
        from hosts.serializers import ChallengeHostTeamSerializer
        
        
        Severity: Major
        Found in apps/challenges/serializers.py - About 1 day to fix

          File seed.py has 514 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # Command to run : python manage.py shell  < scripts/seed.py
          import datetime
          import json
          import os
          import random
          Severity: Major
          Found in scripts/seed.py - About 1 day to fix

            File task_definitions.py has 514 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            task_definition = """
            {{
                "family":"{queue_name}",
                "executionRoleArn":"{EXECUTION_ROLE_ARN}",
                "networkMode":"awsvpc",
            Severity: Major
            Found in apps/challenges/task_definitions.py - About 1 day to fix

              File challengesubmit.component.ts has 513 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { Component, OnInit, QueryList, ViewChildren } from '@angular/core';
              import { Router, ActivatedRoute } from '@angular/router';
              import { NGXLogger } from 'ngx-logger';
              
              // import service

                File remote_submission_worker.py has 504 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                from __future__ import absolute_import
                from __future__ import division
                from __future__ import print_function
                from __future__ import unicode_literals
                
                
                Severity: Major
                Found in scripts/workers/remote_submission_worker.py - About 1 day to fix

                  EndpointsService has 56 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  @Injectable()
                  export class EndpointsService {
                    /**
                     * Categories of API paths
                     */
                  Severity: Major
                  Found in frontend_v2/src/app/services/endpoints.service.ts - About 1 day to fix

                    Function onSuccess has 191 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                                onSuccess: function(response) {
                                    var details = response.data;
                                    vm.page = details;
                                    var offset = new Date(vm.page.start_date).getTimezoneOffset();
                                    vm.page.time_zone = moment.tz.zone(timezone).abbr(offset);
                    Severity: Major
                    Found in frontend/src/js/controllers/challengeCtrl.js - About 7 hrs to fix

                      File utils.py has 485 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import datetime
                      import logging
                      import os
                      import requests
                      import tempfile
                      Severity: Minor
                      Found in apps/jobs/utils.py - About 7 hrs to fix

                        File views.py has 474 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        from django.contrib.auth.models import User
                        
                        from drf_yasg import openapi
                        from drf_yasg.utils import swagger_auto_schema
                        from rest_framework import permissions, status
                        Severity: Minor
                        Found in apps/participants/views.py - About 7 hrs to fix

                          File challengesubmissions.component.ts has 462 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import { Component, OnInit, QueryList, ViewChildren, Input, AfterViewInit } from '@angular/core';
                          import { Router, ActivatedRoute } from '@angular/router';
                          import { NGXLogger } from 'ngx-logger';
                          
                          // import service

                            Function download_all_submissions has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def download_all_submissions(
                                request, challenge_pk, challenge_phase_pk, file_type
                            ):
                                """
                                API endpoint to download all the submissions for a particular challenge as a csv
                            Severity: Minor
                            Found in apps/challenges/views.py - About 7 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 update_failed_jobs_and_send_logs has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def update_failed_jobs_and_send_logs(
                                api_instance,
                                core_v1_api_instance,
                                evalai,
                                job_name,
                            Severity: Minor
                            Found in scripts/workers/code_upload_submission_worker.py - About 6 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

                            File challengeviewallsubmissions.component.ts has 454 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import { Component, OnInit, QueryList, ViewChildren, AfterViewInit } from '@angular/core';
                            import { animate, state, style, transition, trigger } from '@angular/animations';
                            import { Router, ActivatedRoute } from '@angular/router';
                            import { NGXLogger } from 'ngx-logger';
                            
                            

                              Function invite_participant_to_team has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
                              Open

                              def invite_participant_to_team(request, pk):
                                  try:
                                      participant_team = ParticipantTeam.objects.get(pk=pk)
                                  except ParticipantTeam.DoesNotExist:
                                      response_data = {"error": "Participant Team does not exist"}
                              Severity: Minor
                              Found in apps/participants/views.py - About 6 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 FeaturedChallengeCtrl has 167 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  function FeaturedChallengeCtrl(utilities, loaderService, $state, $stateParams, moment) {
                                      var vm = this;
                                      vm.challengeId = $stateParams.challengeId;
                                      vm.phaseSplitId = $stateParams.phaseSplitId;
                                      vm.phaseId = null;
                              Severity: Major
                              Found in frontend/src/js/controllers/featuredChallengeCtrl.js - About 6 hrs to fix

                                Function calculate_distinct_sorted_leaderboard_data has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
                                Open

                                def calculate_distinct_sorted_leaderboard_data(
                                    user, challenge_obj, challenge_phase_split, only_public_entries, order_by
                                ):
                                    """
                                    Function to calculate and return the sorted leaderboard data
                                Severity: Minor
                                Found in apps/jobs/utils.py - About 6 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