YetiForceCompany/YetiForceCRM

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

Summary

Maintainability
D
2 days
Test Coverage

File Index.js has 345 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*+***********************************************************************************
 * The contents of this file are subject to the vtiger CRM Public License Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * The Original Code is:  vtiger CRM Open Source
 * The Initial Developer of the Original Code is vtiger.
Severity: Minor
Found in public_html/layouts/basic/modules/Settings/Vtiger/resources/Index.js - About 4 hrs to fix

    Function registerWarningsAlert has 69 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            registerWarningsAlert: function () {
                const alertsContainer = $('#systemWarningAletrs');
                if (alertsContainer.length) {
                    app.showModalWindow(alertsContainer, function () {
                        alertsContainer.find('.warning').first().removeClass('d-none');
    Severity: Major
    Found in public_html/layouts/basic/modules/Settings/Vtiger/resources/Index.js - About 2 hrs to fix

      Function registerIconsSelect has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              registerIconsSelect(container, params) {
                  AppConnector.request(
                      $.extend(
                          {
                              module: app.getModuleName(),
      Severity: Minor
      Found in public_html/layouts/basic/modules/Settings/Vtiger/resources/Index.js - About 2 hrs to fix

        Function registerAddShortcutDragDropEvent has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                registerAddShortcutDragDropEvent: function () {
                    var elements = $('.js-menu__item .js-menu__link--draggable');
                    var self = this;
                    var classes = 'ui-draggable-menuShortcut bg-warning';
                    elements.draggable({

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

                  registerDeleteShortCutEvent: function (shortcutsContainer = $('.js-shortcuts')) {
                      shortcutsContainer.on('click', '.unpin', (e) => {
                          e.preventDefault();
                          var actionEle = $(e.currentTarget);
                          var closestBlock = actionEle.closest('.js-shortcut');

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

                    registerPinShortCutEvent: function (element) {
                        const id = element.data('id');
                        const url =
                            'index.php?module=Vtiger&parent=Settings&action=Basic&mode=updateFieldPinnedStatus&pin=true&fieldid=' + id;
                        const progressIndicatorElement = $.progressIndicator({

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

                          widgets.on('hidden.bs.collapse', function (e) {
                              var widgetContainer = $(e.currentTarget);
                              var quickWidgetHeader = widgetContainer.closest('.quickWidget').find('.quickWidgetHeader');
                              var imageEle = quickWidgetHeader.find('.imageElement');
                              var imagePath = imageEle.data('rightimage');
              public_html/layouts/basic/modules/Settings/Vtiger/resources/Index.js on lines 170..176

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

              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

                          widgets.on('shown.bs.collapse', function (e) {
                              var widgetContainer = $(e.currentTarget);
                              var quickWidgetHeader = widgetContainer.closest('.quickWidget').find('.quickWidgetHeader');
                              var imageEle = quickWidgetHeader.find('.imageElement');
                              var imagePath = imageEle.data('downimage');
              public_html/layouts/basic/modules/Settings/Vtiger/resources/Index.js on lines 177..183

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

              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 (isExist) {
                                      var params = {
                                          title: app.vtranslate('JS_MESSAGE'),
                                          text: app.vtranslate('JS_SHORTCUT_ALREADY_ADDED'),
                                          type: 'info'
              public_html/layouts/basic/modules/Settings/Workflows/resources/Edit3.js on lines 320..327

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

              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