Cloud-CV/EvalAI

View on GitHub

Showing 666 of 1,371 total issues

Function selectPhaseSplitId has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  selectPhaseSplitId(id, self) {
    let i = 0;
    for (i = 0; i < self.filteredPhaseSplits.length; i++) {
      if (parseInt(id, 10) === self.filteredPhaseSplits[i]['id']) {
        self.selectedPhaseSplit = self.filteredPhaseSplits[i];

    Function updateView has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      updateView() {
        this.teamView['team_name'] = this.team['team_name'];
        this.teamView['created_by'] = this.team['created_by'];
        this.teamView['team_url'] = this.team['team_url'];
        this.teamView['id'] = this.team['id'];

      Function deleteTeamWrapper has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        deleteTeamWrapper() {
          const SELF = this;
          const deleteTeam = (e) => {
            SELF.apiCall = () => {
              SELF.apiService.deleteUrl(SELF.deleteTeamsPath + '/' + e).subscribe(

        Function ngOnInit has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          ngOnInit() {
            this.updateElements();
            this.checkInnerWidth();
        
            this.router.events.pipe(filter((event) => event instanceof NavigationEnd)).subscribe((event) => {

          Function get_submission_by_pk has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def get_submission_by_pk(request, submission_id):
              """
              API endpoint to fetch the details of a submission.
              Only the submission owner or the challenge hosts are allowed.
              """
          Severity: Minor
          Found in apps/jobs/views.py - About 55 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 create_ec2_instance has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def create_ec2_instance(challenge, ec2_storage=None, worker_instance_type=None, worker_image_url=None):
              """
              Create the EC2 instance associated with a challenge.
          
              Args:
          Severity: Minor
          Found in apps/challenges/aws_utils.py - About 55 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 challenge_host_team_detail has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def challenge_host_team_detail(request, pk):
              try:
                  challenge_host_team = ChallengeHostTeam.objects.get(pk=pk)
              except ChallengeHostTeam.DoesNotExist:
                  response_data = {"error": "ChallengeHostTeam does not exist"}
          Severity: Minor
          Found in apps/hosts/views.py - About 55 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 update_challenge_tags_and_domain has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def update_challenge_tags_and_domain(request, challenge_pk):
              """
              Returns or Updates challenge tags and domain
              """
              challenge = get_challenge_model(challenge_pk)
          Severity: Minor
          Found in apps/challenges/views.py - About 55 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 scale_resources has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def scale_resources(challenge, worker_cpu_cores, worker_memory):
              """
              The function called by scale_resources_by_challenge_pk to send the AWS ECS request to update the resources used by
              a challenge's workers.
          
          
          Severity: Minor
          Found in apps/challenges/aws_utils.py - About 55 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 has_permission has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def has_permission(self, request, view):
          
                  if request.method in permissions.SAFE_METHODS:
                      return True
                  elif request.method in ["DELETE", "PATCH", "PUT", "POST"]:
          Severity: Minor
          Found in apps/challenges/permissions.py - About 55 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 get_annotation_file_presigned_url has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def get_annotation_file_presigned_url(request, challenge_phase_pk):
              """
              API to generate a presigned url to upload a test annotation file
          
              Arguments:
          Severity: Minor
          Found in apps/challenges/views.py - About 55 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 scale_selected_workers has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def scale_selected_workers(self, request, queryset):
                  num_of_tasks = int(request.POST["num_of_tasks"])
                  if num_of_tasks >= 0 and num_of_tasks % 1 == 0:
                      response = scale_workers(queryset, num_of_tasks)
                      count, failures = response["count"], response["failures"]
          Severity: Minor
          Found in apps/challenges/admin.py - About 55 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 validate_evaluation_script_file has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def validate_evaluation_script_file(self):
                  evaluation_script = self.yaml_file_data.get("evaluation_script")
                  if evaluation_script:
                      if not evaluation_script.endswith('.zip'):
                          message = self.error_messages_dict.get(
          Severity: Minor
          Found in apps/challenges/challenge_config_utils.py - About 55 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 downloadSubmission has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            downloadSubmission() {
              if (this.challenge['id'] && this.selectedPhase && this.fileSelected) {
                const API_PATH = this.endpointsService.challengeSubmissionDownloadURL(
                  this.challenge['id'],
                  this.selectedPhase['id'],

          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 ngOnInit has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            ngOnInit() {
              if (this.authService.isLoggedIn()) {
                this.isLoggedIn = true;
              }
          
          

          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 ChallengeHostTeamsCtrl has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              function ChallengeHostTeamsCtrl(utilities, loaderService, $scope, $state, $http, $rootScope, $mdDialog) {
          Severity: Major
          Found in frontend/src/js/controllers/challengeHostTeamsCtrl.js - About 50 mins to fix

            Function TeamsCtrl has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                function TeamsCtrl(utilities,loaderService, $scope, $state, $http, $rootScope, $mdDialog) {
            Severity: Major
            Found in frontend/src/js/controllers/teamsCtrl.js - About 50 mins to fix

              Function create_challenge has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def create_challenge(
              Severity: Major
              Found in scripts/seed.py - About 50 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

                  Avoid deeply nested control flow statements.
                  Open

                                                                          if (vm.existTeam.next === null) {
                                                                              vm.isNext = 'disabled';
                                                                              vm.currentPage = vm.existTeam.count / 10;
                                                                          } else {
                                                                              vm.isNext = '';
                  Severity: Major
                  Found in frontend/src/js/controllers/challengeCtrl.js - About 45 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language