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

Summary

Maintainability
F
1 wk
Test Coverage

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

'use strict';

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

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

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

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

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

        Function importEnergyStoragePowerStation has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

          Function deleteEnergyStoragePowerStation has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              $scope.deleteEnergyStoragePowerStation=function(energystoragepowerstation){
                  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.editEnergyStoragePowerStation = function(energystoragepowerstation) {
                    var modalInstance = $uibModal.open({
                        windowClass: "animated fadeIn",
                        templateUrl: 'views/settings/energystoragepowerstation/energystoragepowerstation.model.html',
                        controller: 'ModalEditEnergyStoragePowerStationCtrl',
            myems-admin/app/controllers/settings/microgrid/microgrid.controller.js on lines 114..160

            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.addEnergyStoragePowerStation = function() {
                    var modalInstance = $uibModal.open({
                        templateUrl: 'views/settings/energystoragepowerstation/energystoragepowerstation.model.html',
                        controller: 'ModalAddEnergyStoragePowerStationCtrl',
                        windowClass: "animated fadeIn",
            myems-admin/app/controllers/settings/microgrid/microgrid.controller.js on lines 69..112

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

                $scope.importEnergyStoragePowerStation = function() {
                    var modalInstance = $uibModal.open({
                        templateUrl: 'views/common/import.html',
                        controller: 'ModalImportCtrl',
                        windowClass: "animated fadeIn",
            myems-admin/app/controllers/settings/datasource/datasource.controller.js on lines 226..262
            myems-admin/app/controllers/settings/meter/meter.controller.js on lines 337..373
            myems-admin/app/controllers/settings/meter/virtualmeter.controller.js on lines 280..316
            myems-admin/app/controllers/settings/space/space.controller.js on lines 331..367
            myems-admin/app/controllers/settings/tenant/tenant.controller.js on lines 259..295

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

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

                $scope.cloneEnergyStoragePowerStation = function(energystoragepowerstation){
                    let headers = { "User-UUID": $scope.cur_user.uuid, "Token": $scope.cur_user.token };
                    EnergyStoragePowerStationService.cloneEnergyStoragePowerStation(energystoragepowerstation, headers, function(response) {
                        if (angular.isDefined(response.status) && response.status === 201) {
                            toaster.pop({
            myems-admin/app/controllers/settings/datasource/datasource.controller.js on lines 204..224
            myems-admin/app/controllers/settings/meter/meter.controller.js on lines 315..335
            myems-admin/app/controllers/settings/meter/virtualmeter.controller.js on lines 258..278
            myems-admin/app/controllers/settings/space/space.controller.js on lines 309..329
            myems-admin/app/controllers/settings/tenant/tenant.controller.js on lines 237..257

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

            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('ModalAddEnergyStoragePowerStationCtrl', function($scope, $uibModalInstance,params) {
                $scope.operation = "SETTING.ADD_ENERGY_STORAGE_POWER_STATION";
                $scope.costcenters=params.costcenters;
                $scope.contacts=params.contacts;
                $scope.svgs=params.svgs;
            myems-admin/app/controllers/settings/microgrid/microgrid.controller.js on lines 299..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('ModalEditEnergyStoragePowerStationCtrl', function($scope, $uibModalInstance, params) {
                $scope.operation = "SETTING.EDIT_ENERGY_STORAGE_POWER_STATION";
                $scope.energystoragepowerstation = params.energystoragepowerstation;
                $scope.costcenters=params.costcenters;
                $scope.contacts=params.contacts;
            myems-admin/app/controllers/settings/microgrid/microgrid.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("ENERGY_STORAGE_POWER_STATION.PHASE_1USE")},
                        {"code":"2commissioning", "name": $translate.instant("ENERGY_STORAGE_POWER_STATION.PHASE_2COMMISSIONING")},
                        {"code":"3installation", "name": $translate.instant("ENERGY_STORAGE_POWER_STATION.PHASE_3INSTALLATION")}
            myems-admin/app/controllers/settings/microgrid/microgrid.controller.js on lines 51..57

            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