myems-admin/app/controllers/settings/microgrid/microgrid.controller.js

Summary

Maintainability
F
1 wk
Test Coverage

File microgrid.controller.js has 309 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

app.controller('MicrogridController', function(
    $scope,
    $rootScope,

    Function editMicrogrid has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        $scope.editMicrogrid = function(microgrid) {
            var modalInstance = $uibModal.open({
                windowClass: "animated fadeIn",
                templateUrl: 'views/settings/microgrid/microgrid.model.html',
                controller: 'ModalEditMicrogridCtrl',

      Function addMicrogrid has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          $scope.addMicrogrid = function() {
              var modalInstance = $uibModal.open({
                  templateUrl: 'views/settings/microgrid/microgrid.model.html',
                  controller: 'ModalAddMicrogridCtrl',
                  windowClass: "animated fadeIn",

        Function importMicrogrid has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            $scope.importMicrogrid = function() {
                var modalInstance = $uibModal.open({
                    templateUrl: 'views/common/import.html',
                    controller: 'ModalImportCtrl',
                    windowClass: "animated fadeIn",

          Function deleteMicrogrid has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              $scope.deleteMicrogrid=function(microgrid){
                  SweetAlert.swal({
                          title: $translate.instant("SWEET.TITLE"),
                          text: $translate.instant("SWEET.TEXT"),
                          type: "warning",

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

                $scope.editMicrogrid = function(microgrid) {
                    var modalInstance = $uibModal.open({
                        windowClass: "animated fadeIn",
                        templateUrl: 'views/settings/microgrid/microgrid.model.html',
                        controller: 'ModalEditMicrogridCtrl',
            myems-admin/app/controllers/settings/energystoragepowerstation/energystoragepowerstation.controller.js on lines 116..162

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

            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

                $scope.addMicrogrid = function() {
                    var modalInstance = $uibModal.open({
                        templateUrl: 'views/settings/microgrid/microgrid.model.html',
                        controller: 'ModalAddMicrogridCtrl',
                        windowClass: "animated fadeIn",
            myems-admin/app/controllers/settings/energystoragepowerstation/energystoragepowerstation.controller.js on lines 71..114

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

            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

            app.controller('ModalAddMicrogridCtrl', function($scope, $uibModalInstance,params) {
            
                $scope.operation = "SETTING.ADD_MICROGRID";
                $scope.costcenters=params.costcenters;
                $scope.contacts=params.contacts;
            myems-admin/app/controllers/settings/energystoragepowerstation/energystoragepowerstation.controller.js on lines 300..316

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

            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

            app.controller('ModalEditMicrogridCtrl', function($scope, $uibModalInstance, params) {
                $scope.operation = "SETTING.EDIT_MICROGRID";
                $scope.microgrid = params.microgrid;
                $scope.costcenters=params.costcenters;
                $scope.contacts=params.contacts;
            myems-admin/app/controllers/settings/energystoragepowerstation/energystoragepowerstation.controller.js on lines 318..332

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

            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

                $scope.getAllPhaseOfLifecycles = function() {
                    $scope.phaseoflifecycles = [
                        {"code":"1use", "name": $translate.instant("MICROGRID.PHASE_1USE")},
                        {"code":"2commissioning", "name": $translate.instant("MICROGRID.PHASE_2COMMISSIONING")},
                        {"code":"3installation", "name": $translate.instant("MICROGRID.PHASE_3INSTALLATION")}
            myems-admin/app/controllers/settings/energystoragepowerstation/energystoragepowerstation.controller.js on lines 63..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 88.

            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