Cloud-CV/EvalAI

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

Summary

Maintainability
F
1 wk
Test Coverage

Function ChallengeHostTeamsCtrl has 328 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

        utilities.showLoader();
Severity: Major
Found in frontend/src/js/controllers/challengeHostTeamsCtrl.js - About 1 day to fix

    File challengeHostTeamsCtrl.js has 337 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // Invoking IIFE for teams
    (function() {
    
        'use strict';
    
    
    Severity: Minor
    Found in frontend/src/js/controllers/challengeHostTeamsCtrl.js - About 4 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 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 updateChallengeHostTeamData has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    vm.updateChallengeHostTeamData = function(updateChallengeHostTeamDataForm) {
                        if (updateChallengeHostTeamDataForm) {
                        var parameters = {};
                        parameters.url = 'hosts/challenge_host_team/' + vm.hostTeamId;
                        parameters.method = 'PATCH';
            Severity: Minor
            Found in frontend/src/js/controllers/challengeHostTeamsCtrl.js - About 1 hr to fix

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

                              onSuccess: function(response) {
                                  $rootScope.notify("success", "New team- '" + vm.team.name + "' has been created");
                                  var details = response.data;
                                  vm.teamId = details.id;
                                  vm.team.error = false;
              Severity: Minor
              Found in frontend/src/js/controllers/challengeHostTeamsCtrl.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");
                
                                        var parameters = {};
                Severity: Minor
                Found in frontend/src/js/controllers/challengeHostTeamsCtrl.js - About 1 hr to fix

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

                          vm.inviteOthers = function(ev, hostTeamId) {
                              ev.stopPropagation();
                              // Appending dialog to document.body 
                              var confirm = $mdDialog.prompt()
                                  .title('Add other members to your team')
                  Severity: Minor
                  Found in frontend/src/js/controllers/challengeHostTeamsCtrl.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/challengeHostTeamsCtrl.js - About 1 hr to fix

                      Function ChallengeHostTeamsCtrl has 7 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          function ChallengeHostTeamsCtrl(utilities, loaderService, $scope, $state, $http, $rootScope, $mdDialog) {
                      Severity: Major
                      Found in frontend/src/js/controllers/challengeHostTeamsCtrl.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");
                        
                                                var parameters = {};
                        Severity: Major
                        Found in frontend/src/js/controllers/challengeHostTeamsCtrl.js and 1 other location - About 2 days to fix
                        frontend/src/js/controllers/teamsCtrl.js on lines 266..313

                        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/challengeHostTeamsCtrl.js and 1 other location - About 1 day to fix
                        frontend/src/js/controllers/teamsCtrl.js on lines 113..153

                        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/challengeHostTeamsCtrl.js and 2 other locations - About 1 day to fix
                        frontend/src/js/controllers/challengeCtrl.js on lines 1706..1738
                        frontend/src/js/controllers/teamsCtrl.js on lines 199..231

                        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", "Host team updated!");
                                            var parameters = {};
                        Severity: Major
                        Found in frontend/src/js/controllers/challengeHostTeamsCtrl.js and 1 other location - About 7 hrs to fix
                        frontend/src/js/controllers/teamsCtrl.js on lines 403..423

                        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/challengeHostTeamsCtrl.js and 1 other location - About 4 hrs to fix
                        frontend/src/js/controllers/teamsCtrl.js on lines 371..381

                        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/challengeHostTeamsCtrl.js and 1 other location - About 2 hrs to fix
                        frontend/src/js/controllers/teamsCtrl.js on lines 53..60

                        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();
                                            $rootScope.notify("error",  error.team_name[0]);
                        Severity: Major
                        Found in frontend/src/js/controllers/challengeHostTeamsCtrl.js and 1 other location - About 2 hrs to fix
                        frontend/src/js/controllers/teamsCtrl.js on lines 234..240

                        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 your team')
                                        .textContent('Enter the email address of the person')
                                        .placeholder('email')
                                        .ariaLabel('')
                        Severity: Major
                        Found in frontend/src/js/controllers/challengeHostTeamsCtrl.js and 1 other location - About 1 hr to fix
                        frontend/src/js/controllers/teamsCtrl.js on lines 331..338

                        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/challengeHostTeamsCtrl.js and 2 other locations - About 1 hr to fix
                        frontend/src/js/controllers/challengeCtrl.js on lines 503..507
                        frontend/src/js/controllers/teamsCtrl.js on lines 76..80

                        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/challengeHostTeamsCtrl.js and 1 other location - About 1 hr to fix
                        frontend/src/js/controllers/teamsCtrl.js on lines 250..256

                        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/challengeHostTeamsCtrl.js and 1 other location - About 40 mins to fix
                        frontend/src/js/controllers/teamsCtrl.js on lines 426..431

                        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/challengeHostTeamsCtrl.js and 2 other locations - About 35 mins to fix
                        frontend/src/js/controllers/challengeCtrl.js on lines 492..496
                        frontend/src/js/controllers/teamsCtrl.js on lines 65..69

                        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