dsd-meetme/frontend

View on GitHub
app/components/organization/group/groupController.js

Summary

Maintainability
F
5 days
Test Coverage

Function controller has 305 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var controller = function ($routeParams, $location, mixedContentToArray, orgResources, arrayToUrlParams) {

        var c = this;
        //group id
        var id = $routeParams.id;
Severity: Major
Found in app/components/organization/group/groupController.js - About 1 day to fix

    File groupController.js has 311 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    (function () {
    
        var controller = function ($routeParams, $location, mixedContentToArray, orgResources, arrayToUrlParams) {
    
            var c = this;
    Severity: Minor
    Found in app/components/organization/group/groupController.js - About 3 hrs to fix

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

                  change: function () {
                      var validMembers = [];
                      angular.forEach(this.members, function (value, key) {
                          if (value === true) {
                              validMembers.push(key.toString());
      Severity: Minor
      Found in app/components/organization/group/groupController.js - About 1 hr to fix

        Function change has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    change: function () {
                        if (!this.plannerId) {
                            this.errors.push('Select a user to be planner');
                        }
                        else if (this.plannerId !== c.data.group.planner_id) {
        Severity: Minor
        Found in app/components/organization/group/groupController.js - About 1 hr to fix

          Function controller has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              var controller = function ($routeParams, $location, mixedContentToArray, orgResources, arrayToUrlParams) {
          Severity: Minor
          Found in app/components/organization/group/groupController.js - About 35 mins to fix

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

                        user: {
                            pages: 1,
                            currentPage: 1,
                            utilArray: null,
                            startIndex: 0,
            Severity: Major
            Found in app/components/organization/group/groupController.js and 2 other locations - About 1 day to fix
            app/components/organization/dashboard/odashController.js on lines 54..77
            app/components/organization/dashboard/odashController.js on lines 78..100

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

            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

                    c.delete = function () {
                        //restful delete
                        c.confirmPopup.message = "Deleting group";
                        c.confirmPopup.show();
                        orgResources.orgGroup.remove({groupId: id}).$promise
            Severity: Major
            Found in app/components/organization/group/groupController.js and 1 other location - About 4 hrs to fix
            app/components/organization/user/userController.js on lines 34..46

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

            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

                            orgResources.orgGroup.update({groupId: id}, jQuery.param(
                                {
                                    name: c.data.groupCopy.name,
                                    description: c.data.groupCopy.description,
                                    planner_id: c.data.group.planner_id
            Severity: Major
            Found in app/components/organization/group/groupController.js and 1 other location - About 4 hrs to fix
            app/components/organization/user/userController.js on lines 77..88

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

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                                    }, function (response) {
                                        //Puts relevant errors in array
                                        if (response.status === 422) {
                                            mixedContentToArray.process(response.data, c.errors.planner, true);
                                            c.confirmPopup.hide();
            Severity: Major
            Found in app/components/organization/group/groupController.js and 2 other locations - About 3 hrs to fix
            app/components/organization/dashboard/odashController.js on lines 170..178
            app/components/organization/dashboard/odashController.js on lines 180..188

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

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

                    c.confirmPopup = {
                        message: '',
                        show: function () {
                            jQuery('#authorizationPopup').modal('show');
                        },
            Severity: Major
            Found in app/components/organization/group/groupController.js and 6 other locations - About 1 hr to fix
            app/components/organization/dashboard/odashController.js on lines 30..38
            app/components/organization/profile/opController.js on lines 20..28
            app/components/user/composeSchedule/cschedController.js on lines 50..58
            app/components/user/dashboard/udashController.js on lines 156..164
            app/components/user/meeting/nmController.js on lines 387..395
            app/components/user/profile/upController.js on lines 12..20

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

            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

                            angular.forEach(this.members, function (value, key) {
                                if (value === true) {
                                    validMembers.push(key.toString());
                                }
                            });
            Severity: Minor
            Found in app/components/organization/group/groupController.js and 1 other location - About 50 mins to fix
            app/components/organization/dashboard/odashController.js on lines 137..141

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

            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