YetiForceCompany/YetiForceCRM

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

Summary

Maintainability
F
5 days
Test Coverage

File WidgetsManagement.js has 567 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';

jQuery.Class(
    'Settings_WidgetsManagement_Js',

    Function addMiniListWidget has 149 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            addMiniListWidget: function (element, url) {
                // 1. Show popup window for selection (module, filter, fields)
                // 2. Compute the dynamic mini-list widget url
                // 3. Add widget with URL to the page.
                const thisInstance = this;

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

              addNoteBookWidget: function (element, url) {
                  var thisInstance = this;
                  element = jQuery(element);
                  app.showModalWindow(null, 'index.php?module=Home&view=AddNotePad', function (wizardContainer) {
                      var form = jQuery('form', wizardContainer);

        Function addRssWidget has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                addRssWidget: function (element, url) {
                    var thisInstance = this;
                    var objectToShowModal = {
                        url: 'index.php?module=' + app.getModuleName() + '&parent=' + app.getParentModuleName() + '&view=AddRss',
                        cb: function (container) {

          Function registerAddBlockDashBoard has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  registerAddBlockDashBoard: function () {
                      var thisInstance = this;
                      var contents = jQuery('#layoutDashBoards');
                      contents.find('.addBlockDashBoard').on('click', function (e) {
                          var addBlockContainer = contents.find('.addBlockDashBoardModal').clone(true, true);

            Function cb has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                            cb: function (container) {
                                container.find('.removeChannel').on('click', function (e) {
                                    var currentTarget = $(e.currentTarget);
                                    var row = currentTarget.closest('.form-group');
                                    row.remove();

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

                      registerDashboardAction() {
                          const thisInstance = this;
                          $('.editDashboard').on('click', (e) => {
                              let currentTarget = $(e.currentTarget);
                              e.stopPropagation();

                Function onValidationComplete has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                                            onValidationComplete: function (form, valid) {
                                                if (valid) {
                                                    //To prevent multiple click on save
                                                    jQuery("[name='saveButton']", wizardContainer).attr('disabled', 'disabled');
                                                    var notePadName = form.find('[name="notePadName"]').val();

                  Function registerDeleteWidgetEvent has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          registerDeleteWidgetEvent: function (contents) {
                              if (typeof contents === 'undefined') {
                                  contents = jQuery('#layoutDashBoards');
                              }
                              contents.find('.js-delete-widget').on('click', (e) => {

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

                            save: function (form, mode, params = null) {
                                var aDeferred = jQuery.Deferred();
                                var progressIndicatorElement = jQuery.progressIndicator({
                                    position: 'html',
                                    blockInfo: {

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

                                      fieldsSelect2.on('change', function () {
                                          fieldHrefDOM.find('option:not([value=""]').remove();
                                          $(this)
                                              .find('option:checked')
                                              .each(function (index, element) {
                      public_html/layouts/basic/modules/Vtiger/resources/DashBoard.js on lines 387..402

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

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

                                  AppConnector.request(params)
                                      .done(function (data) {
                                          progressIndicatorElement.progressIndicator({ mode: 'hide' });
                                          aDeferred.resolve(data);
                                      })
                      public_html/layouts/basic/modules/Settings/ModuleManager/resources/ModuleImport.js on lines 39..47
                      public_html/layouts/basic/modules/Settings/ModuleManager/resources/ModuleManager.js on lines 113..121
                      public_html/layouts/basic/modules/Vtiger/resources/DashBoard.js on lines 501..509

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

                      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 (data['success']) {
                                                  app.hideModalWindow();
                                                  paramsForm['id'] = result['id'];
                                                  paramsForm['status'] = result['status'];
                                                  params['text'] = app.vtranslate('JS_WIDGET_ADDED');
                      public_html/layouts/basic/modules/Vtiger/resources/DashBoard.js on lines 450..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 90.

                      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

                                              newRow.find('.removeChannel').on('click', function (e) {
                                                  var currentTarget = $(e.currentTarget);
                                                  var row = currentTarget.closest('.form-group');
                                                  row.remove();
                                              });
                      public_html/layouts/basic/modules/Settings/MarketingProcesses/resources/Index.js on lines 63..67
                      public_html/layouts/basic/modules/Settings/WidgetsManagement/resources/WidgetsManagement.js on lines 181..185

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

                      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

                                          container.find('.removeChannel').on('click', function (e) {
                                              var currentTarget = $(e.currentTarget);
                                              var row = currentTarget.closest('.form-group');
                                              row.remove();
                                          });
                      public_html/layouts/basic/modules/Settings/MarketingProcesses/resources/Index.js on lines 63..67
                      public_html/layouts/basic/modules/Settings/WidgetsManagement/resources/WidgetsManagement.js on lines 193..197

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

                      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

                                          AppConnector.request({
                                              module: 'Home',
                                              view: 'MiniListWizard',
                                              step: 'step3',
                                              selectedModule: moduleNameSelect2.val(),
                      public_html/layouts/basic/modules/Vtiger/resources/DashBoard.js on lines 364..385

                      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

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

                                  container.find('.addNotebook').on('click', function (e) {
                                      thisInstance.addNoteBookWidget(this, jQuery(this).data('url'));
                                  });
                      public_html/layouts/basic/modules/Settings/WidgetsManagement/resources/WidgetsManagement.js on lines 169..171

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

                      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

                                  container.find('.addMiniList').on('click', function (e) {
                                      thisInstance.addMiniListWidget(this, jQuery(this).data('url'));
                                  });
                      public_html/layouts/basic/modules/Settings/WidgetsManagement/resources/WidgetsManagement.js on lines 166..168

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

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

                                                  form.find('.channelRss:not(:disabled)').each(function () {
                                                      channels.push(jQuery(this).val());
                                                  });
                      public_html/layouts/basic/modules/Settings/TwoFactorAuthentication/resources/Index.js on lines 57..59
                      public_html/layouts/basic/modules/Settings/Wapro/resources/List.js on lines 51..53
                      public_html/layouts/basic/modules/Vtiger/resources/Detail.js on lines 2101..2103
                      public_html/layouts/basic/modules/Vtiger/resources/Detail.js on lines 2139..2141
                      public_html/layouts/basic/modules/Vtiger/resources/Detail.js on lines 2143..2145
                      public_html/layouts/basic/modules/Vtiger/resources/PDF.js on lines 64..66
                      public_html/layouts/resources/Calendar.js on lines 351..353

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

                      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

                                          fieldsSelect2 = App.Fields.Picklist.showSelect2ElementView(fieldsSelectDOM, {
                                              placeholder: app.vtranslate('JS_PLEASE_SELECT_ATLEAST_ONE_OPTION'),
                                              closeOnSelect: true,
                                              maximumSelectionLength: 6
                                          }),
                      public_html/layouts/basic/modules/Vtiger/resources/DashBoard.js on lines 331..335

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

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

                                              let progress = $.progressIndicator({
                                                  message: app.vtranslate('JS_SAVE_LOADER_INFO'),
                                                  position: 'html',
                                                  blockInfo: {
                                                      enabled: true
                      public_html/layouts/basic/modules/Settings/ConfReport/resources/Index.js on lines 13..19
                      public_html/layouts/basic/modules/Settings/LayoutEditor/resources/LayoutEditor.js on lines 1729..1735
                      public_html/layouts/basic/modules/Settings/LayoutEditor/resources/LayoutEditor.js on lines 1947..1953
                      public_html/layouts/basic/modules/Settings/Search/resources/Search.js on lines 81..87
                      public_html/layouts/basic/modules/Settings/Widgets/resources/Widgets.js on lines 98..104
                      public_html/layouts/basic/modules/Users/resources/Edit.js on lines 110..116
                      public_html/layouts/basic/modules/Users/resources/List.js on lines 200..206
                      public_html/layouts/basic/modules/Vtiger/resources/Detail.js on lines 1881..1887
                      public_html/layouts/basic/modules/Vtiger/resources/List.js on lines 1922..1928
                      public_html/layouts/basic/modules/Vtiger/resources/PDF.js on lines 9..15
                      public_html/layouts/basic/modules/Vtiger/resources/RelatedList.js on lines 888..894
                      public_html/layouts/resources/app.js on lines 250..256
                      public_html/layouts/resources/app.js on lines 440..446

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

                      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