Cloud-CV/EvalAI

View on GitHub

Showing 1,371 of 1,371 total issues

Similar blocks of code found in 4 locations. Consider refactoring.
Open

    def start_selected_workers(self, request, queryset):
        response = start_workers(queryset)
        count, failures = response["count"], response["failures"]

        if count == queryset.count():
Severity: Major
Found in apps/challenges/admin.py and 3 other locations - About 1 day to fix
apps/challenges/admin.py on lines 114..131
apps/challenges/admin.py on lines 170..189
apps/challenges/admin.py on lines 195..212

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 137.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        it('should handle the API error for `togglePublishChallengeState` method', async(() => {
          const expectedApiError = {
            error: 'Api error',
          };
          spyOn(apiService, 'patchUrl').and.returnValue(
      frontend_v2/src/app/components/challenge/challenge.component.spec.ts on lines 280..299

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 209.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        it('should handle the API error for `deleteChallenge` method', async(() => {
          const expectedApiError = {
            error: 'Api error',
          };
          spyOn(apiService, 'postUrl').and.returnValue(
      frontend_v2/src/app/components/challenge/challenge.component.spec.ts on lines 187..206

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 209.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

                    resolve: {
                      challenge: function(utilities, $state, $stateParams) {
                        return new Promise(function(resolve, reject) {
                          var parameters = {};
                          parameters.token = utilities.getData('userKey');
        Severity: Major
        Found in frontend/src/js/route-config/route-config.js and 1 other location - About 1 day to fix
        frontend/src/js/route-config/route-config.js on lines 352..377

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 206.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

                    resolve: {
                      challenge: function(utilities, $state, $stateParams) {
                        return new Promise(function(resolve, reject) {
                          var parameters = {};
                          parameters.token = utilities.getData('userKey');
        Severity: Major
        Found in frontend/src/js/route-config/route-config.js and 1 other location - About 1 day to fix
        frontend/src/js/route-config/route-config.js on lines 282..307

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 206.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

            def validate_challenge_description(self):
                challenge_description = self.yaml_file_data.get("description")
                if not challenge_description or len(challenge_description) == 0:
                    message = self.error_messages_dict.get(
                        "missing_challenge_description"
        Severity: Major
        Found in apps/challenges/challenge_config_utils.py and 3 other locations - About 1 day to fix
        apps/challenges/challenge_config_utils.py on lines 429..450
        apps/challenges/challenge_config_utils.py on lines 454..475
        apps/challenges/challenge_config_utils.py on lines 479..502

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 128.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

            def validate_terms_and_conditions_file(self):
                terms_and_conditions = self.yaml_file_data.get("terms_and_conditions")
                if not terms_and_conditions or len(terms_and_conditions) == 0:
                    message = self.error_messages_dict.get(
                        "missing_terms_and_conditions"
        Severity: Major
        Found in apps/challenges/challenge_config_utils.py and 3 other locations - About 1 day to fix
        apps/challenges/challenge_config_utils.py on lines 406..425
        apps/challenges/challenge_config_utils.py on lines 429..450
        apps/challenges/challenge_config_utils.py on lines 479..502

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 128.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        def stop_instance(challenge, evalai_interface):
            instance_details = evalai_interface.get_ec2_instance_details(challenge["id"])
            instance = instance_details["message"]
            if instance["State"]["Name"] == "running":
                response = evalai_interface.stop_challenge_ec2_instance(challenge["id"])
        Severity: Major
        Found in scripts/monitoring/auto_scale_ec2_workers.py and 1 other location - About 1 day to fix
        scripts/monitoring/auto_scale_ec2_workers.py on lines 56..70

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 128.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        def start_instance(challenge, evalai_interface):
            instance_details = evalai_interface.get_ec2_instance_details(challenge["id"])
            instance = instance_details["message"]
            if instance["State"]["Name"] == "stopped":
                response = evalai_interface.start_challenge_ec2_instance(challenge["id"])
        Severity: Major
        Found in scripts/monitoring/auto_scale_ec2_workers.py and 1 other location - About 1 day to fix
        scripts/monitoring/auto_scale_ec2_workers.py on lines 37..51

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 128.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

            def validate_submission_guidelines_file(self):
                submission_guidelines = self.yaml_file_data.get(
                    "submission_guidelines"
                )
                if not submission_guidelines or len(submission_guidelines) == 0:
        Severity: Major
        Found in apps/challenges/challenge_config_utils.py and 3 other locations - About 1 day to fix
        apps/challenges/challenge_config_utils.py on lines 406..425
        apps/challenges/challenge_config_utils.py on lines 429..450
        apps/challenges/challenge_config_utils.py on lines 454..475

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 128.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

            def validate_evaluation_details_file(self):
                evaluation_details = self.yaml_file_data.get("evaluation_details")
                if not evaluation_details or len(evaluation_details) == 0:
                    message = self.error_messages_dict.get(
                        "missing_evaluation_details"
        Severity: Major
        Found in apps/challenges/challenge_config_utils.py and 3 other locations - About 1 day to fix
        apps/challenges/challenge_config_utils.py on lines 406..425
        apps/challenges/challenge_config_utils.py on lines 454..475
        apps/challenges/challenge_config_utils.py on lines 479..502

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 128.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        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

              Identical blocks of code found in 3 locations. Consider refactoring.
              Open

                  if not is_user_a_host_of_challenge(request.user, challenge.pk):
                      # Check if challenge phase is public and accepting solutions
                      if not challenge_phase.is_public:
                          response_data = {
                              "error": "Sorry, cannot accept submissions since challenge phase is not public"
              Severity: Major
              Found in apps/jobs/views.py and 2 other locations - About 1 day to fix
              apps/jobs/views.py on lines 2739..2762
              apps/jobs/views.py on lines 2857..2878

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 125.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 3 locations. Consider refactoring.
              Open

                  if not is_user_a_host_of_challenge(request.user, challenge.pk):
                      if not challenge_phase.is_public:
                          response_data = {
                              "error": "Sorry, cannot accept submissions since challenge phase is not public"
                          }
              Severity: Major
              Found in apps/jobs/views.py and 2 other locations - About 1 day to fix
              apps/jobs/views.py on lines 2566..2589
              apps/jobs/views.py on lines 2739..2762

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 125.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 3 locations. Consider refactoring.
              Open

                  if not is_user_a_host_of_challenge(request.user, challenge.pk):
                      # Check if challenge phase is public and accepting solutions
                      if not challenge_phase.is_public:
                          response_data = {
                              "error": "Sorry, cannot accept submissions since challenge phase is not public"
              Severity: Major
              Found in apps/jobs/views.py and 2 other locations - About 1 day to fix
              apps/jobs/views.py on lines 2566..2589
              apps/jobs/views.py on lines 2857..2878

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 125.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Severity
              Category
              Status
              Source
              Language