YetiForceCompany/YetiForceCRM

View on GitHub
public_html/layouts/basic/modules/Settings/PublicHoliday/resources/PublicHoliday.js

Summary

Maintainability
D
2 days
Test Coverage

Function registerMassActionEvent has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        registerMassActionEvent(container) {
            let thisInstance = this;
            $('.masscopy', container).click((e) => {
                let isChecked = $('.mass-selector', container).is(':checked');
                if (isChecked) {

    File PublicHoliday.js has 266 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* {[The file is published on the basis of YetiForce Public License 6.5 that can be found in the following directory: licenses/LicenseEN.txt or yetiforce.com]} */
    'use strict';
    
    $.Class(
        'Settings_PublicHoliday_Js',

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

              registerDeleteHolidayEvent(container) {
                  let thisInstance = this;
                  this.$itemsContainer.on('click', '.deleteHoliday', (e) => {
                      app.showConfirmModal({
                          title: app.vtranslate('JS_DELETE_RECORD_CONFIRMATION'),

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

                registerModalSubmitEvent(container) {
                    let thisInstance = this;
                    $('form', this.$editModal)
                        .add($('form', this.$duplicateModal))
                        .on('submit', (e) => {

          Function confirmedCallback has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                                  confirmedCallback: () => {
                                      let recordList = $('.mass-selector:checked', container)
                                          .map((idx, selector) => {
                                              return $(selector).data('id');
                                          })

            Function confirmedCallback has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                                confirmedCallback: () => {
                                    let $target = $(e.target);
                                    let $holidayDetails = $target.closest('.holidayElement').data();
                                    Settings_PublicHoliday_Js.showProgressive();
                                    AppConnector.request({

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

                                      AppConnector.request({
                                          parent: app.getParentModuleName(),
                                          module: app.getModuleName(),
                                          action: 'Holiday',
                                          mode: 'delete',
              public_html/layouts/basic/modules/Settings/PublicHoliday/resources/PublicHoliday.js on lines 103..111
              public_html/layouts/basic/modules/Settings/PublicHoliday/resources/PublicHoliday.js on lines 271..285

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

              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

                                          AppConnector.request({
                                              parent: app.getParentModuleName(),
                                              module: app.getModuleName(),
                                              action: 'Holiday',
                                              mode: 'massDelete',
              public_html/layouts/basic/modules/Settings/PublicHoliday/resources/PublicHoliday.js on lines 103..111
              public_html/layouts/basic/modules/Settings/PublicHoliday/resources/PublicHoliday.js on lines 177..191

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

              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

                                      AppConnector.request(params)
                                          .done((response) => {
                                              Settings_PublicHoliday_Js.hideProgressive();
                                              Settings_Vtiger_Index_Js.showMessage({
                                                  text: response.result.message,
              public_html/layouts/basic/modules/Settings/PublicHoliday/resources/PublicHoliday.js on lines 177..191
              public_html/layouts/basic/modules/Settings/PublicHoliday/resources/PublicHoliday.js on lines 271..285

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

              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

                                  let recordList = $('.mass-selector:checked', container)
                                      .map((_, selector) => {
                                          return $(selector).data('id');
                                      })
                                      .toArray();
              public_html/layouts/basic/modules/Settings/PublicHoliday/resources/PublicHoliday.js on lines 265..269

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

              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

                                          let recordList = $('.mass-selector:checked', container)
                                              .map((idx, selector) => {
                                                  return $(selector).data('id');
                                              })
                                              .toArray();
              public_html/layouts/basic/modules/Settings/PublicHoliday/resources/PublicHoliday.js on lines 245..249

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

              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