Cloud-CV/EvalAI

View on GitHub
frontend/src/js/controllers/teamsCtrl.js

Summary

Maintainability
F
1 wk
Test Coverage

Function TeamsCtrl has 347 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function TeamsCtrl(utilities,loaderService, $scope, $state, $http, $rootScope, $mdDialog) {
        var vm = this;
        var userKey = utilities.getData('userKey');
        var challengePk = 1;

Severity: Major
Found in frontend/src/js/controllers/teamsCtrl.js - About 1 day to fix

    File teamsCtrl.js has 356 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // Invoking IIFE for teams
    (function() {
    
        'use strict';
    
    
    Severity: Minor
    Found in frontend/src/js/controllers/teamsCtrl.js - About 4 hrs to fix

      Function onSuccess has 81 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/teamsCtrl.js - About 3 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 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 updateParticipantTeamData has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    vm.updateParticipantTeamData = function(updateParticipantTeamDataForm) {
                        if (updateParticipantTeamDataForm) {
                        var parameters = {};
                        parameters.url = 'participants/participant_team/' + vm.participantTeamId;
                        parameters.method = 'PATCH';
            Severity: Minor
            Found in frontend/src/js/controllers/teamsCtrl.js - About 1 hr to fix

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

                              onSuccess: function() {
                                  $rootScope.notify("success", "Team " + vm.team.name + " has been created successfully!");
                                  vm.team.error = false;
                                  vm.stopLoader();
                                  // reset the team attributes
              Severity: Minor
              Found in frontend/src/js/controllers/teamsCtrl.js - About 1 hr to fix

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

                                    onSuccess: function() {
                
                                        vm.team.error = false;
                                        $rootScope.notify("info", "You have removed yourself successfully");
                
                
                Severity: Minor
                Found in frontend/src/js/controllers/teamsCtrl.js - About 1 hr to fix

                  Function inviteOthers has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          vm.inviteOthers = function(ev, participantTeamId) {
                              ev.stopPropagation();
                              // Appending dialog to document.body to cover sidenav in docs app
                              var confirm = $mdDialog.prompt()
                                  .title('Add other members to this Team')
                  Severity: Minor
                  Found in frontend/src/js/controllers/teamsCtrl.js - About 1 hr to fix

                    Function load has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                                        vm.load = function(url) {
                                            // loader for existing teams
                                            vm.isExistLoader = true;
                                            vm.loaderTitle = '';
                                            vm.loaderContainer = angular.element('.exist-team-card');
                    Severity: Minor
                    Found in frontend/src/js/controllers/teamsCtrl.js - About 1 hr 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

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

                                            onSuccess: function() {
                        
                                                vm.team.error = false;
                                                $rootScope.notify("info", "You have removed yourself successfully");
                        
                        
                        Severity: Major
                        Found in frontend/src/js/controllers/teamsCtrl.js and 1 other location - About 2 days to fix
                        frontend/src/js/controllers/challengeHostTeamsCtrl.js on lines 314..360

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

                        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

                                            vm.load = function(url) {
                                                // loader for existing teams
                                                vm.isExistLoader = true;
                                                vm.loaderTitle = '';
                                                vm.loaderContainer = angular.element('.exist-team-card');
                        Severity: Major
                        Found in frontend/src/js/controllers/teamsCtrl.js and 1 other location - About 1 day to fix
                        frontend/src/js/controllers/challengeHostTeamsCtrl.js on lines 86..125

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

                        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

                                            parameters.callback = {
                                                onSuccess: function(response) {
                                                    var status = response.status;
                                                    var details = response.data;
                                                    if (status == 200) {
                        Severity: Major
                        Found in frontend/src/js/controllers/teamsCtrl.js and 2 other locations - About 1 day to fix
                        frontend/src/js/controllers/challengeCtrl.js on lines 1706..1738
                        frontend/src/js/controllers/challengeHostTeamsCtrl.js on lines 247..279

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

                        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

                                        onSuccess: function() {
                                            $mdDialog.hide();
                                            vm.team = {};
                                            $rootScope.notify("success", "Participant Team updated!");
                                            var parameters = {};
                        Severity: Major
                        Found in frontend/src/js/controllers/teamsCtrl.js and 1 other location - About 7 hrs to fix
                        frontend/src/js/controllers/challengeHostTeamsCtrl.js on lines 178..198

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

                        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

                                    parameters.callback = {
                                        onSuccess: function(response) {
                                            vm.team.teamName = response.data.team_name;
                                            vm.team.teamUrl = response.data.team_url;
                                        },
                        Severity: Major
                        Found in frontend/src/js/controllers/teamsCtrl.js and 1 other location - About 4 hrs to fix
                        frontend/src/js/controllers/challengeHostTeamsCtrl.js on lines 145..155

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

                        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

                                            if (vm.existTeam.count === 0) {
                                                vm.showPagination = false;
                                                vm.paginationMsg = "No team exists for now. Start by creating a new team!";
                                            } else {
                                                vm.activateCollapsible();
                        Severity: Major
                        Found in frontend/src/js/controllers/teamsCtrl.js and 1 other location - About 2 hrs to fix
                        frontend/src/js/controllers/challengeHostTeamsCtrl.js on lines 55..62

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

                        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

                                        onError: function(response) {
                                            var error = response.data;
                        
                                            vm.team.error = error.team_name[0];
                                            vm.stopLoader();
                        Severity: Major
                        Found in frontend/src/js/controllers/teamsCtrl.js and 1 other location - About 2 hrs to fix
                        frontend/src/js/controllers/challengeHostTeamsCtrl.js on lines 283..288

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

                        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

                                    var confirm = $mdDialog.prompt()
                                        .title('Add other members to this Team')
                                        .textContent('Enter the email address of the person')
                                        .placeholder('email')
                                        .ariaLabel('')
                        Severity: Major
                        Found in frontend/src/js/controllers/teamsCtrl.js and 1 other location - About 1 hr to fix
                        frontend/src/js/controllers/challengeHostTeamsCtrl.js on lines 375..382

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

                        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

                                            if (vm.existTeam.next !== null) {
                                                vm.currentPage = vm.existTeam.next.split('page=')[1] - 1;
                                            } else {
                                                vm.currentPage = 1;
                                            }
                        Severity: Major
                        Found in frontend/src/js/controllers/teamsCtrl.js and 2 other locations - About 1 hr to fix
                        frontend/src/js/controllers/challengeCtrl.js on lines 503..507
                        frontend/src/js/controllers/challengeHostTeamsCtrl.js on lines 79..83

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

                        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

                                    var confirm = $mdDialog.confirm()
                                        .title('Would you like to remove yourself?')
                                        .textContent('Note: This action will remove you from the team.')
                                        .ariaLabel('Lucky day')
                                        .targetEvent(ev)
                        Severity: Major
                        Found in frontend/src/js/controllers/teamsCtrl.js and 1 other location - About 1 hr to fix
                        frontend/src/js/controllers/challengeHostTeamsCtrl.js on lines 298..304

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

                        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

                                            if ('team_name' in response.data) {
                                                error = response.data['team_name'];
                                            }
                                            else {
                                                error = response.data['error'];
                        Severity: Minor
                        Found in frontend/src/js/controllers/teamsCtrl.js and 1 other location - About 40 mins to fix
                        frontend/src/js/controllers/challengeHostTeamsCtrl.js on lines 201..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 49.

                        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 (vm.existTeam.next === null) {
                                                vm.isNext = 'disabled';
                                            } else {
                                                vm.isNext = '';
                                            }
                        Severity: Minor
                        Found in frontend/src/js/controllers/teamsCtrl.js and 2 other locations - About 35 mins to fix
                        frontend/src/js/controllers/challengeCtrl.js on lines 492..496
                        frontend/src/js/controllers/challengeHostTeamsCtrl.js on lines 68..72

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

                        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

                        There are no issues that match your filters.

                        Category
                        Status