Cloud-CV/EvalAI

View on GitHub

Showing 1,371 of 1,371 total issues

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

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

    function vendorjs() {
        var paths = [];
        _.forIn(scripts.chunks, function(chunkScripts, chunkName) {
            chunkScripts.forEach(function(script) {
                var scriptFileName = scripts.paths[script];
    Severity: Major
    Found in gulpfile.js and 1 other location - About 6 hrs to fix
    gulpfile.js on lines 59..75

    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 174.

    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

    function vendorcss() {
        var paths = [];
        _.forIn(styles.chunks, function(chunkStyles, chunkName) {
            chunkStyles.forEach(function(style) {
                var styleFileName = styles.paths[style];
    Severity: Major
    Found in gulpfile.js and 1 other location - About 6 hrs to fix
    gulpfile.js on lines 38..54

    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 174.

    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

    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';
    
    

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

      function configProd() {
          return gulp.src('frontend/src/js/config.sample.js')
              .pipe(replace('moduleName', 'evalai-config'))
              .pipe(replace('constantName', Object.keys(configJson.production)))
              .pipe(replace('configKey', Object.keys(configJson.production.EnvironmentConfig)))
      Severity: Major
      Found in gulpfile.js and 2 other locations - About 6 hrs to fix
      gulpfile.js on lines 196..207
      gulpfile.js on lines 212..223

      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 172.

      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 3 locations. Consider refactoring.
      Open

      function configDev() {
          return gulp.src('frontend/src/js/config.sample.js')
              .pipe(replace('moduleName', 'evalai-config'))
              .pipe(replace('constantName', Object.keys(configJson.local)))
              .pipe(replace('configKey', Object.keys(configJson.local.EnvironmentConfig)))
      Severity: Major
      Found in gulpfile.js and 2 other locations - About 6 hrs to fix
      gulpfile.js on lines 180..191
      gulpfile.js on lines 196..207

      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 172.

      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 3 locations. Consider refactoring.
      Open

      function configStaging() {
          return gulp.src('frontend/src/js/config.sample.js')
              .pipe(replace('moduleName', 'evalai-config'))
              .pipe(replace('constantName', Object.keys(configJson.staging)))
              .pipe(replace('configKey', Object.keys(configJson.staging.EnvironmentConfig)))
      Severity: Major
      Found in gulpfile.js and 2 other locations - About 6 hrs to fix
      gulpfile.js on lines 180..191
      gulpfile.js on lines 212..223

      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 172.

      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

      (function() {
          'use strict';
          // dynamic header directive
          angular
              .module('evalai')
      Severity: Major
      Found in frontend/src/js/directives/directives.js and 1 other location - About 6 hrs to fix
      frontend/src/js/directives/directives.js on lines 241..272

      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 172.

      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

      (function() {
          'use strict';
          // dynamic header directive
          angular.module('evalai').directive('simHeader', simHeader);
      
      
      Severity: Major
      Found in frontend/src/js/directives/directives.js and 1 other location - About 6 hrs to fix
      frontend/src/js/directives/directives.js on lines 2..35

      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 172.

      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 get_core_v1_api_object(cluster_name, cluster_endpoint, challenge, evalai):
          configuration = client.Configuration()
          aws_eks_api = evalai.get_aws_eks_bearer_token(challenge.get("id"))
          configuration.host = cluster_endpoint
          configuration.verify_ssl = True
      Severity: Major
      Found in scripts/workers/code_upload_submission_worker.py and 1 other location - About 6 hrs to fix
      scripts/workers/code_upload_submission_worker.py on lines 460..471

      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 108.

      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 get_api_object(cluster_name, cluster_endpoint, challenge, evalai):
          configuration = client.Configuration()
          aws_eks_api = evalai.get_aws_eks_bearer_token(challenge.get("id"))
          configuration.host = cluster_endpoint
          configuration.verify_ssl = True
      Severity: Major
      Found in scripts/workers/code_upload_submission_worker.py and 1 other location - About 6 hrs to fix
      scripts/workers/code_upload_submission_worker.py on lines 488..499

      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 108.

      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

      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

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

            def validate_leaderboards(self, current_leaderboard_config_ids):
                leaderboard = self.yaml_file_data.get("leaderboard")
                if leaderboard:
                    for data in leaderboard:
                        error = False
        Severity: Minor
        Found in apps/challenges/challenge_config_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

        Function getResults has 164 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                vm.getResults = function(phaseId) {
                    // long polling (5s) for leaderboard
                    vm.start = function() {
                        vm.stopFetchingSubmissions();
                        vm.poller = $interval(function() {
        Severity: Major
        Found in frontend/src/js/controllers/challengeCtrl.js - About 6 hrs to fix

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

          import { Component, OnInit, ViewChildren, QueryList, OnDestroy } from '@angular/core';
          import { ApiService } from '../../../services/api.service';
          import { GlobalService } from '../../../services/global.service';
          import { AuthService } from '../../../services/auth.service';
          import { Router, ActivatedRoute } from '@angular/router';

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

            import { Component, OnInit, QueryList, ViewChildren, AfterViewInit, OnDestroy } from '@angular/core';
            import { MatDialog } from '@angular/material/dialog';
            import { Router, ActivatedRoute } from '@angular/router';
            
            // import component
              Severity
              Category
              Status
              Source
              Language