YetiForceCompany/YetiForceCRM

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

Summary

Maintainability
D
2 days
Test Coverage

File Widgets.js has 336 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_Widgets_Index_Js',

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

            registerEvents: function (container) {
                var thisInstance = this;
                this.loadWidgets();
                if (typeof container === 'undefined') {
                    container = jQuery('.WidgetsManage');

      Function createStep2 has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              createStep2: function (type) {
                  var thisInstance = this;
                  var tabId = thisInstance.getTabId();
                  var progressIndicatorElement = jQuery.progressIndicator({ position: 'html' });
                  app.showModalWindow(

        Function modalFormEdit has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                modalFormEdit(wizardContainer) {
                    const thisInstance = this;
                    $('#massEditHeader.modal-title').text(app.vtranslate('JS_EDIT_WIDGET'));
                    app.showPopoverElementView(wizardContainer.find('.js-help-info'));
                    let type = thisInstance.getType();

          Function loadFilters has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  loadFilters: function (contener) {
                      let types = ['filter', 'checkbox', 'switchHeader'];
                      let selected = contener.find("select[name='relation_id'] option:selected");
                      let relatedModuleInput = contener.find("input[name='relatedmodule']");
                      let relatedModule = relatedModuleInput.val();

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

                        if (type == 'RelatedModule' || type === 'RelatedModuleChart' || type === 'Documents') {
                            thisInstance.loadFilters(wizardContainer);
                            thisInstance.relatedModuleFields(wizardContainer);
                            thisInstance.customView(wizardContainer);
                            wizardContainer.find("select[name='relation_id']").on('change', function () {
            public_html/layouts/basic/modules/Settings/Widgets/resources/Widgets.js on lines 23..32

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

            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 (type === 'RelatedModule' || type === 'RelatedModuleChart' || type === 'Documents') {
                                    thisInstance.loadFilters(wizardContainer);
                                    thisInstance.relatedModuleFields(wizardContainer);
                                    thisInstance.customView(wizardContainer);
                                    wizardContainer.find("select[name='relation_id']").on('change', function () {
            public_html/layouts/basic/modules/Settings/Widgets/resources/Widgets.js on lines 230..239

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

            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

                                        wizardContainer.find('.js-sort-container_element:not(.js-base-element)').each(function () {
                                            let orderBy = $(this).find('.js-orderBy').val();
                                            if (orderBy) {
                                                sortData[orderBy] = $(this).find('.js-sort-order').val();
                                            }
            public_html/layouts/basic/modules/Vtiger/resources/SortOrderModal.js on lines 78..83

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

            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

                        var Indicator = jQuery.progressIndicator({
                            message: app.vtranslate('Loading data'),
                            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/WidgetsManagement/resources/WidgetsManagement.js on lines 526..532
            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