myems-admin/app/controllers/users/user/user.controller.js

Summary

Maintainability
F
4 days
Test Coverage

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

'use strict';

app.controller('UserController', function ($scope,
    $rootScope,
    $window,
Severity: Minor
Found in myems-admin/app/controllers/users/user/user.controller.js - About 6 hrs to fix

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

        $scope.editUser = function (user) {
            var modalInstance = $uibModal.open({
                windowClass: "animated fadeIn",
                templateUrl: 'views/users/user/user.model.html',
                controller: 'ModalEditUserCtrl',
    Severity: Minor
    Found in myems-admin/app/controllers/users/user/user.controller.js - About 1 hr to fix

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

          $scope.resetPassword = function (user) {
              var modalInstance = $uibModal.open({
                  windowClass: "animated fadeIn",
                  templateUrl: 'views/users/user/reset-password.model.html',
                  controller: 'ModalResetPasswordCtrl',
      Severity: Minor
      Found in myems-admin/app/controllers/users/user/user.controller.js - About 1 hr to fix

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

            $scope.approveUser = function (user) {
                var modalInstance = $uibModal.open({
                    templateUrl: 'views/users/user/approve-user.html',
                    controller: 'ModalApproveUserCtrl',
                    windowClass: "animated fadeIn",
        Severity: Minor
        Found in myems-admin/app/controllers/users/user/user.controller.js - About 1 hr to fix

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

              $scope.addUser = function () {
                  var modalInstance = $uibModal.open({
                      templateUrl: 'views/users/user/user.model.html',
                      controller: 'ModalAddUserCtrl',
                      windowClass: "animated fadeIn",
          Severity: Minor
          Found in myems-admin/app/controllers/users/user/user.controller.js - About 1 hr to fix

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

                $scope.deleteUser = function (user) {
                    SweetAlert.swal({
                        title: $translate.instant("SWEET.TITLE"),
                        text: $translate.instant("SWEET.TEXT"),
                        type: "warning",
            Severity: Minor
            Found in myems-admin/app/controllers/users/user/user.controller.js - About 1 hr to fix

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

                  $scope.deleteUser = function (user) {
                      SweetAlert.swal({
                          title: $translate.instant("SWEET.TITLE"),
                          text: $translate.instant("SWEET.TEXT"),
                          type: "warning",
              Severity: Minor
              Found in myems-admin/app/controllers/users/user/user.controller.js - About 1 hr to fix

                Function unlockUser has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    $scope.unlockUser = function (user){
                        SweetAlert.swal({
                            title: $translate.instant("SWEET.UNLOCK_TITLE"),
                            type: "warning",
                            showCancelButton: true,
                Severity: Minor
                Found in myems-admin/app/controllers/users/user/user.controller.js - About 1 hr to fix

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

                      $scope.ok = function () {
                          if ($scope.user.is_admin) {
                              $scope.user.privilege_id = undefined;
                          }else {
                              $scope.user.is_read_only = undefined;
                  Severity: Major
                  Found in myems-admin/app/controllers/users/user/user.controller.js and 1 other location - About 6 hrs to fix
                  myems-admin/app/controllers/users/user/user.controller.js on lines 478..487

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

                  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

                      $scope.ok = function () {
                          if ($scope.user.is_admin) {
                              $scope.user.privilege_id = undefined;
                          }else {
                              $scope.user.is_read_only = undefined;
                  Severity: Major
                  Found in myems-admin/app/controllers/users/user/user.controller.js and 1 other location - About 6 hrs to fix
                  myems-admin/app/controllers/users/user/user.controller.js on lines 374..383

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

                  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

                  app.controller('ModalResetPasswordCtrl', function ($scope, $uibModalInstance, params) {
                      $scope.user = params.user;
                  
                      $scope.ok = function () {
                          $uibModalInstance.close($scope.user);
                  Severity: Major
                  Found in myems-admin/app/controllers/users/user/user.controller.js and 2 other locations - About 2 hrs to fix
                  myems-admin/app/controllers/fdd/webmessage/webmessage.controller.js on lines 115..124
                  myems-admin/app/controllers/users/user/user.controller.js on lines 443..453

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

                  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

                  app.controller('ModalChangePasswordCtrl', function ($scope, $uibModalInstance, params) {
                      $scope.user = params.user;
                  
                      $scope.ok = function () {
                          $uibModalInstance.close($scope.user);
                  Severity: Major
                  Found in myems-admin/app/controllers/users/user/user.controller.js and 2 other locations - About 2 hrs to fix
                  myems-admin/app/controllers/fdd/webmessage/webmessage.controller.js on lines 115..124
                  myems-admin/app/controllers/users/user/user.controller.js on lines 431..441

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

                  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

                      if ($scope.user.privilege != null) {
                          $scope.user.privilege_id = $scope.user.privilege.id;
                      } else {
                          $scope.user.privilege_id = undefined;
                      }
                  Severity: Major
                  Found in myems-admin/app/controllers/users/user/user.controller.js and 1 other location - About 1 hr to fix
                  myems-admin/app/controllers/settings/category/energyitem.controller.js on lines 182..186

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

                  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

                      $scope.dtOptions = {
                          locale:{
                              format: 'YYYY-MM-DD HH:mm:ss',
                              applyLabel: "OK",
                              cancelLabel: "Cancel",
                  Severity: Major
                  Found in myems-admin/app/controllers/users/user/user.controller.js and 2 other locations - About 1 hr to fix
                  myems-admin/app/controllers/users/user/user.controller.js on lines 400..411
                  myems-admin/app/controllers/users/user/user.controller.js on lines 466..477

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

                  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

                      $scope.dtOptions = {
                          locale: {
                              format: 'YYYY-MM-DD HH:mm:ss',
                              applyLabel: "OK",
                              cancelLabel: "Cancel",
                  Severity: Major
                  Found in myems-admin/app/controllers/users/user/user.controller.js and 2 other locations - About 1 hr to fix
                  myems-admin/app/controllers/users/user/user.controller.js on lines 362..373
                  myems-admin/app/controllers/users/user/user.controller.js on lines 466..477

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

                  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

                      $scope.dtOptions = {
                          locale:{
                              format: 'YYYY-MM-DD HH:mm:ss',
                              applyLabel: "OK",
                              cancelLabel: "Cancel",
                  Severity: Major
                  Found in myems-admin/app/controllers/users/user/user.controller.js and 2 other locations - About 1 hr to fix
                  myems-admin/app/controllers/users/user/user.controller.js on lines 362..373
                  myems-admin/app/controllers/users/user/user.controller.js on lines 400..411

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

                  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