YetiForceCompany/YetiForceCRM

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

Summary

Maintainability
F
5 days
Test Coverage

File DashBoard.js has 609 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*+**********************************************************************************
 * The contents of this file are subject to the vtiger CRM Public License Version 1.1
 * ("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: Major
Found in public_html/layouts/basic/modules/Vtiger/resources/DashBoard.js - About 1 day to fix

    Function registerMiniListWidget has 122 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            registerMiniListWidget: function () {
                const thisInstance = this;
                $('.dashboardHeading')
                    .off('click', '.js-add-filter')
                    .on('click', '.js-add-filter', function (e) {
    Severity: Major
    Found in public_html/layouts/basic/modules/Vtiger/resources/DashBoard.js - About 4 hrs to fix

      `` has 25 functions (exceeds 20 allowed). Consider refactoring.
      Open

          {
              container: false,
              noCache: false,
              instancesCache: {},
              init: function () {
      Severity: Minor
      Found in public_html/layouts/basic/modules/Vtiger/resources/DashBoard.js - About 2 hrs to fix

        Function saveMiniListWidget has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                saveMiniListWidget: function (data, element, moduleNameLabel, filterid, filterLabel, form) {
                    const thisInstance = this,
                        paramsForm = {
                            data: JSON.stringify(data),
                            blockid: element.data('block-id'),
        Severity: Minor
        Found in public_html/layouts/basic/modules/Vtiger/resources/DashBoard.js - About 1 hr to fix

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

                  loadWidget: function (widgetContainer) {
                      const self = this;
                      let urlParams = widgetContainer.data('url');
                      let mode = widgetContainer.data('mode');
                      let moduleName = app.getModuleName();
          Severity: Minor
          Found in public_html/layouts/basic/modules/Vtiger/resources/DashBoard.js - About 1 hr to fix

            Function removeWidget has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    removeWidget: function () {
                        const self = this;
                        this.getContainer().on('click', '.js-widget-remove', function (e) {
                            let element = $(e.currentTarget),
                                listItem = $(element).parents('.grid-stack-item'),
            Severity: Minor
            Found in public_html/layouts/basic/modules/Vtiger/resources/DashBoard.js - About 1 hr to fix

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

                      saveWidget: function (form, mode, sourceModule, linkid, type) {
                          let aDeferred = $.Deferred();
                          let progressIndicatorElement = $.progressIndicator({
                              position: 'html',
                              blockInfo: {
              Severity: Minor
              Found in public_html/layouts/basic/modules/Vtiger/resources/DashBoard.js - About 1 hr to fix

                Function saveMiniListWidget has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        saveMiniListWidget: function (data, element, moduleNameLabel, filterid, filterLabel, form) {
                Severity: Minor
                Found in public_html/layouts/basic/modules/Vtiger/resources/DashBoard.js - About 45 mins to fix

                  Function saveWidget has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          saveWidget: function (form, mode, sourceModule, linkid, type) {
                  Severity: Minor
                  Found in public_html/layouts/basic/modules/Vtiger/resources/DashBoard.js - About 35 mins to fix

                    Function loadWidget has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                            loadWidget: function (widgetContainer) {
                                const self = this;
                                let urlParams = widgetContainer.data('url');
                                let mode = widgetContainer.data('mode');
                                let moduleName = app.getModuleName();
                    Severity: Minor
                    Found in public_html/layouts/basic/modules/Vtiger/resources/DashBoard.js - About 25 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    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/Settings/WidgetsManagement/resources/WidgetsManagement.js on lines 351..366

                    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/Settings/WidgetsManagement/resources/WidgetsManagement.js on lines 151..159

                    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'] = result['text'];
                    public_html/layouts/basic/modules/Settings/WidgetsManagement/resources/WidgetsManagement.js on lines 408..424

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

                                container.on('mousedown.draggable', function (e) {
                                    let element = $(e.target);
                                    let isHeaderElement = element.closest('.dashboardWidgetHeader').length > 0 ? true : false;
                                    if (isHeaderElement) {
                                        return;
                    public_html/layouts/basic/modules/Vtiger/resources/dashboards/Widget.js on lines 1391..1399

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

                    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(),
                    Severity: Minor
                    Found in public_html/layouts/basic/modules/Vtiger/resources/DashBoard.js and 1 other location - About 55 mins to fix
                    public_html/layouts/basic/modules/Settings/WidgetsManagement/resources/WidgetsManagement.js on lines 334..349

                    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

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

                                            const fieldsSelect2 = App.Fields.Picklist.showSelect2ElementView(fieldsSelectDOM, {
                                                placeholder: app.vtranslate('JS_PLEASE_SELECT_ATLEAST_ONE_OPTION'),
                                                closeOnSelect: true,
                                                maximumSelectionLength: 6
                                            });
                    Severity: Minor
                    Found in public_html/layouts/basic/modules/Vtiger/resources/DashBoard.js and 1 other location - About 35 mins to fix
                    public_html/layouts/basic/modules/Settings/WidgetsManagement/resources/WidgetsManagement.js on lines 297..301

                    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

                    There are no issues that match your filters.

                    Category
                    Status