myems-admin/app/controllers/settings/workingcalendar/workingcalendarnonworkingday.controller.js

Summary

Maintainability
F
4 days
Test Coverage

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

'use strict';

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

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

        $scope.addNonWorkingDay = function() {
            var modalInstance = $uibModal.open({
                templateUrl: 'views/settings/workingcalendar/nonworkingday.model.html',
                controller: 'ModalAddNonWorkingDayCtrl',
                windowClass: "animated fadeIn",

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

          $scope.editNonWorkingDay = function(nonWorkingDay) {
              var modalInstance = $uibModal.open({
                  windowClass: "animated fadeIn",
                  templateUrl: 'views/settings/workingcalendar/nonworkingday.model.html',
                  controller: 'ModalEditNonWorkingDayCtrl',

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

            $scope.deleteNonWorkingDay = function(nonworkingday) {
                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

                  modalInstance.result.then(function(nonWorkingDay) {
                      let headers = { "User-UUID": $scope.cur_user.uuid, "Token": $scope.cur_user.token };
                      WorkingCalendarNonWorkingDayService.editNonWorkingDay(nonWorkingDay.id, nonWorkingDay, headers, function (response) {
                          if (angular.isDefined(response.status) && response.status === 200) {
                              toaster.pop({
          myems-admin/app/controllers/settings/workingcalendar/workingcalendarnonworkingday.controller.js on lines 141..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 253.

          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

                  modalInstance.result.then(function(nonWorkingDay) {
                      let headers = { "User-UUID": $scope.cur_user.uuid, "Token": $scope.cur_user.token };
                      WorkingCalendarNonWorkingDayService.addNonWorkingDay(nonWorkingDay.working_calendar_id, nonWorkingDay,
                           headers, function (response) {
                          if (angular.isDefined(response.status) && response.status === 201) {
          myems-admin/app/controllers/settings/workingcalendar/workingcalendarnonworkingday.controller.js on lines 183..203

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

          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() {
                  $scope.nonWorkingDay.working_calendar_id = $scope.workingCalendar.id;
                  $scope.nonWorkingDay.date_local = moment($scope.nonWorkingDay.date_local).format('YYYY-MM-DD');
                  $uibModalInstance.close($scope.nonWorkingDay);
              };
          myems-admin/app/controllers/settings/workingcalendar/workingcalendarnonworkingday.controller.js on lines 298..302

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

          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() {
                  $scope.nonWorkingDay.working_calendar_id = $scope.workingCalendar.id;
                  $scope.nonWorkingDay.date_local = moment($scope.nonWorkingDay.date_local).format('YYYY-MM-DD');
                  $uibModalInstance.close($scope.nonWorkingDay);
              };
          myems-admin/app/controllers/settings/workingcalendar/workingcalendarnonworkingday.controller.js on lines 272..276

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

          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.dtOptions = {
                  locale: {
                      format: 'YYYY-MM-DD',
                      applyLabel: "OK",
                      cancelLabel: "Cancel",
          myems-admin/app/controllers/settings/tenant/tenant.controller.js on lines 316..326
          myems-admin/app/controllers/settings/tenant/tenant.controller.js on lines 344..354
          myems-admin/app/controllers/settings/workingcalendar/workingcalendarnonworkingday.controller.js on lines 259..269
          myems-admin/app/controllers/users/apikey/apikey.controller.js on lines 175..185
          myems-admin/app/controllers/users/apikey/apikey.controller.js on lines 210..220

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

          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.dtOptions = {
                  locale: {
                      format: 'YYYY-MM-DD',
                      applyLabel: "OK",
                      cancelLabel: "Cancel",
          myems-admin/app/controllers/settings/tenant/tenant.controller.js on lines 316..326
          myems-admin/app/controllers/settings/tenant/tenant.controller.js on lines 344..354
          myems-admin/app/controllers/settings/workingcalendar/workingcalendarnonworkingday.controller.js on lines 287..297
          myems-admin/app/controllers/users/apikey/apikey.controller.js on lines 175..185
          myems-admin/app/controllers/users/apikey/apikey.controller.js on lines 210..220

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

          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