Cloud-CV/EvalAI

View on GitHub

Showing 666 of 1,371 total issues

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

def challenge_detail(request, challenge_host_team_pk, challenge_pk):
    try:
        challenge_host_team = ChallengeHostTeam.objects.get(
            pk=challenge_host_team_pk
        )
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 challenge_phase_detail has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

def challenge_phase_detail(request, challenge_pk, pk):
    try:
        challenge = Challenge.objects.get(pk=challenge_pk)
    except Challenge.DoesNotExist:
        response_data = {"error": "Challenge does not exist"}
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 add_prizes_to_challenge has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

def add_prizes_to_challenge(yaml_file_data, challenge):
    if "prizes" in yaml_file_data:
        prizes_data = yaml_file_data['prizes']
        rank_set = set()
        for prize in prizes_data:
Severity: Minor
Found in apps/challenges/utils.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 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

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

                onSuccess: function(response) {
                    var status = response.status;
                    var details = response.data;
                    if (status == 200) {
                        vm.existTeam = details;
    Severity: Major
    Found in frontend/src/js/controllers/challengeHostTeamsCtrl.js - About 2 hrs to fix

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

              vm.createNewTeam = function() {
                  vm.isExistLoader = true;
                  vm.loaderTitle = '';
                  vm.loaderContainer = angular.element('.new-team-card');
      
      
      Severity: Major
      Found in frontend/src/js/controllers/teamsCtrl.js - About 2 hrs to fix

        Function showRemainingSubmissions has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                vm.showRemainingSubmissions = function(phaseID) {
                    vm.remainingSubmissions = {};
                    vm.remainingTime = {};
                    vm.showClock = false;
                    vm.showSubmissionNumbers = false;
        Severity: Major
        Found in frontend/src/js/controllers/challengeCtrl.js - About 2 hrs to fix

          Function updateProfile has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  vm.updateProfile = function(resetconfirmFormValid, editid) {
                      if (resetconfirmFormValid) {
                          vm.user.github_url = vm.user.github_url === null ? "" : vm.user.github_url;
                          vm.user.google_scholar_url = vm.user.google_scholar_url === null ? "" : vm.user.google_scholar_url;
                          vm.user.linkedin_url = vm.user.linkedin_url === null ? "" : vm.user.linkedin_url;
          Severity: Major
          Found in frontend/src/js/controllers/profileCtrl.js - About 2 hrs to fix

            EvalAI_Interface has 22 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class EvalAI_Interface:
                def __init__(self, AUTH_TOKEN, EVALAI_API_SERVER):
                    self.AUTH_TOKEN = AUTH_TOKEN
                    self.EVALAI_API_SERVER = EVALAI_API_SERVER
            
            
            Severity: Minor
            Found in scripts/monitoring/evalai_interface.py - About 2 hrs to fix

              TeamlistComponent has 22 functions (exceeds 20 allowed). Consider refactoring.
              Open

              @Component({
                selector: 'app-teamlist',
                templateUrl: './teamlist.component.html',
                styleUrls: ['./teamlist.component.scss'],
              })

                Function validateModalInput has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  validateModalInput(e) {
                    this.inputErrorMessage = '';
                    if (e.target.name === 'challegenDeleteInput') {
                      this.isDisabled = e.target.value !== this.challenge.title;
                    } else if (e.target.name === 'editChallengeTitle') {
                Severity: Major
                Found in frontend_v2/src/app/components/utility/modal/modal.component.ts - About 2 hrs to fix

                  Function toggleLeaderboardVisibility has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    toggleLeaderboardVisibility() {
                      const SELF = this;
                      let toggleLeaderboardVisibilityState, visibility, phaseIsPublic;
                      for (let i = 0; i < SELF.filteredPhases.length; i++) {
                        if (SELF.filteredPhases[i]['name'] === SELF.selectedPhaseSplit['challenge_phase_name']) {

                    Function change_submission_data_and_visibility has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def change_submission_data_and_visibility(
                        request, challenge_pk, challenge_phase_pk, submission_pk
                    ):
                        """
                        API Endpoint for updating the submission meta data
                    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 run has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def run(*args):
                        try:
                            NUMBER_OF_CHALLENGES = int(args[0])
                            status = check_database()
                            if status is False:
                    Severity: Minor
                    Found in scripts/seed.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 update_allowed_email_ids has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def update_allowed_email_ids(request, challenge_pk, phase_pk):
                        """
                        API to GET/UPDATE/DELETE email ids from challenge phase allowed email ids
                        Arguments:
                            challenge_pk {int} -- Challenge primary key
                    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 ngOnInit has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                      ngOnInit() {
                        if (!this.type || this.type === 'email') {
                          if (this.type === 'email') {
                            this.isEmail = true;
                          }
                    Severity: Minor
                    Found in frontend_v2/src/app/components/utility/input/input.component.ts - 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 createNewTeam has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            vm.createNewTeam = function() {
                                vm.isLoader = true;
                                vm.loaderTitle = '';
                                vm.newContainer = angular.element('.new-team-card');
                    
                    
                    Severity: Major
                    Found in frontend/src/js/controllers/challengeCtrl.js - About 2 hrs to fix

                      Function editChallengePhase has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              vm.editChallengePhase = function(editChallengePhaseForm) {
                                  if (editChallengePhaseForm) {
                                      vm.challengePhaseId = vm.page.challenge_phase.id;
                                      parameters.url = "challenges/challenge/" + vm.challengeId + "/challenge_phase/" + vm.challengePhaseId;
                                      parameters.method = 'PATCH';
                      Severity: Major
                      Found in frontend/src/js/controllers/challengeCtrl.js - About 2 hrs to fix

                        Function displayDockerSubmissionInstructions has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                    vm.displayDockerSubmissionInstructions = function (isDockerBased, isParticipated) {
                                    // get remaining submission for docker based challenge
                                    if (isDockerBased && isParticipated == true && vm.eligible_to_submit) {
                                        parameters.url = 'jobs/' + vm.challengeId + '/remaining_submissions/';
                                        parameters.method = 'GET';
                        Severity: Major
                        Found in frontend/src/js/controllers/challengeCtrl.js - About 2 hrs to fix

                          Function userSignUp has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            userSignUp(signupFormValid) {
                              if (signupFormValid) {
                                let email = this.authService.regUser['email'];
                                this.globalService.startLoader('Setting up your details!');
                                const SIGNUP_BODY = JSON.stringify({
                          Severity: Major
                          Found in frontend_v2/src/app/components/auth/signup/signup.component.ts - About 2 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language