Cloud-CV/EvalAI

View on GitHub

Showing 666 of 1,371 total issues

Function ChallengeCreateCtrl has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function ChallengeCreateCtrl(utilities, loaderService, $rootScope, $state) {
        var vm = this;
        var userKey = utilities.getData('userKey');
        vm.hostTeamId = utilities.getData('challengeHostTeamId');
        vm.wrnMsg = {};
Severity: Major
Found in frontend/src/js/controllers/challengeCreate.js - About 2 hrs to fix

    Function togglePhaseVisibility has 70 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      togglePhaseVisibility() {
        const SELF = this;
        let togglePhaseVisibilityState, isPublic;
        if (SELF.phaseVisibility.state === 'Public') {
          togglePhaseVisibilityState = 'private';

      Function scale_resources_by_challenge_pk has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

      def scale_resources_by_challenge_pk(request, challenge_pk):
          """
          The function called by a host to update the resources used by their challenge.
      
          Calls the scale_resources method. Before calling, checks if the caller hosts the challenge and provided valid CPU
      Severity: Minor
      Found in apps/challenges/views.py - About 2 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 onSuccess has 68 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                      onSuccess: function(response) {
                          var details = response.data;
      
                          for (var i = 0; i < details.results.length; i++) {
                              vm.submissionVisibility[details.results[i].id] = details.results[i].is_public;
      Severity: Major
      Found in frontend/src/js/controllers/challengeCtrl.js - About 2 hrs to fix

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

        import base64
        import json
        import logging
        import os
        import re
        Severity: Minor
        Found in apps/base/utils.py - About 2 hrs to fix

          Function fetchSubmissions has 66 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            fetchSubmissions(challenge, phase) {
              const SELF = this;
              let API_PATH;
              if (SELF.filterSubmissionsQuery === '') {
                API_PATH = SELF.endpointsService.allChallengeSubmissionURL(challenge, phase);

            File challenge.service.ts has 276 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { Injectable } from '@angular/core';
            import { BehaviorSubject } from 'rxjs';
            import { NGXLogger } from 'ngx-logger';
            import { Router } from '@angular/router';
            
            
            Severity: Minor
            Found in frontend_v2/src/app/services/challenge.service.ts - About 2 hrs to fix

              File challenge.component.spec.ts has 276 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { async, ComponentFixture, TestBed } from '@angular/core/testing';
              import { HeaderStaticComponent } from '../../components/nav/header-static/header-static.component';
              import { ChallengeComponent } from './challenge.component';
              import { ApiService } from '../../services/api.service';
              import { GlobalService } from '../../services/global.service';
              Severity: Minor
              Found in frontend_v2/src/app/components/challenge/challenge.component.spec.ts - About 2 hrs to fix

                Function update_leaderboard_data has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                def update_leaderboard_data(request, leaderboard_data_pk):
                    """API endpoint to update a metric in leaderboard data
                
                    Arguments:
                        request {HttpRequest} -- The request object
                Severity: Minor
                Found in apps/jobs/views.py - About 2 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 request_challenge_approval_by_pk has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                def request_challenge_approval_by_pk(request, challenge_pk):
                    """
                    Checks if all challenge phases have finished submissions for the given challenge
                    and send approval request for the challenge
                    """
                Severity: Minor
                Found in apps/challenges/views.py - About 2 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 views.py has 272 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                from django.contrib.auth.models import User
                
                from rest_framework import permissions, status
                from rest_framework.decorators import (
                    api_view,
                Severity: Minor
                Found in apps/hosts/views.py - About 2 hrs to fix

                  Function confirmDelete has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          vm.confirmDelete = function(ev, participantTeamId) {
                              ev.stopPropagation();
                              // Appending dialog to document.body to cover sidenav in docs app
                              var confirm = $mdDialog.confirm()
                                  .title('Would you like to remove yourself?')
                  Severity: Major
                  Found in frontend/src/js/controllers/teamsCtrl.js - About 2 hrs to fix

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

                                    onSuccess: function(response) {
                                        var details = response.data;
                                        vm.submissionResult = details;
                    
                                        if (Array.isArray(vm.submissionResult.results)) {
                    Severity: Major
                    Found in frontend/src/js/controllers/challengeCtrl.js - About 2 hrs to fix

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

                                      onSuccess: function(response) {
                                          var details = response.data;
                                          vm.leaderboard = details.results;
                                          for (var i=0; i<vm.leaderboard.length; i++) {
                                              var dateTimeNow = moment(new Date());
                      Severity: Major
                      Found in frontend/src/js/controllers/featuredChallengeCtrl.js - About 2 hrs to fix

                        Function MainCtrl has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            function MainCtrl(utilities, $rootScope, $state) {
                        
                                var vm = this;
                                vm.user = {};
                                vm.challengeList = [];
                        Severity: Major
                        Found in frontend/src/js/controllers/mainCtrl.js - About 2 hrs to fix

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

                                          onSuccess: function(response) {
                                              var details = response.data;
                                              vm.leaderboard = details.results;
                          
                                              // setting last_submission time
                          Severity: Major
                          Found in frontend/src/js/controllers/challengeCtrl.js - About 2 hrs to fix

                            Function confirmDelete has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    vm.confirmDelete = function(ev, hostTeamId) {
                                        ev.stopPropagation();
                                        // Appending dialog to document.body to cover sidenav in docs app
                                        var confirm = $mdDialog.confirm()
                                            .title('Would you like to remove yourself?')
                            Severity: Major
                            Found in frontend/src/js/controllers/challengeHostTeamsCtrl.js - About 2 hrs to fix

                              Function createNewTeam has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      vm.createNewTeam = function() {
                                          vm.isExistLoader = true;
                                          vm.loaderTitle = '';
                              
                                          vm.startLoader("Loading Teams");
                              Severity: Major
                              Found in frontend/src/js/controllers/challengeHostTeamsCtrl.js - About 2 hrs to fix

                                Function send_submission_message has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                                Open

                                def send_submission_message(request, challenge_phase_pk, submission_pk):
                                    """
                                    API to send a submisison message to the challenge specific SQS queue
                                
                                    Arguments:
                                Severity: Minor
                                Found in apps/jobs/views.py - About 2 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 make_request has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                                Open

                                def make_request(url, method, data=None):
                                    headers = get_request_headers()
                                    if method == "GET":
                                        try:
                                            response = requests.get(url=url, headers=headers)
                                Severity: Minor
                                Found in scripts/workers/remote_submission_worker.py - About 2 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