YetiForceCompany/YetiForceCRM

View on GitHub
public_html/layouts/basic/modules/CustomView/resources/CustomView.js

Summary

Maintainability
D
2 days
Test Coverage

File CustomView.js has 391 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/CustomView/resources/CustomView.js - About 5 hrs to fix

    Function registerSubmitEvent has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        registerSubmitEvent(select2Element) {
            $('#CustomView').on('submit', (e) => {
                const form = $(e.currentTarget);
                let selectElement = this.getColumnSelectElement();
                if ($('#viewname').val().length > 100) {
    Severity: Major
    Found in public_html/layouts/basic/modules/CustomView/resources/CustomView.js - About 2 hrs to fix

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

          registerAppendCustomLabels() {
              let shorterNamesContainer = this.container.find('.js-custom-name-fields');
              let selectedColumns = this.container
                  .find('.js-view-columns-select option:selected')
                  .toArray()

        Function registerCustomViewAdvCondEvents has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            static registerCustomViewAdvCondEvents(listViewContainer) {
                listViewContainer.on('click', '.js-custom-view-adv-cond-modal', () => {
                    const customViewAdvCond = listViewContainer.find('.js-custom-view-adv-cond');
                    let advancedConditions = customViewAdvCond.val();
                    if (advancedConditions) {

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

              static registerAdvancedConditionsEvents(container) {
                  const self = this;
                  const builder = container.find('.js-adv-condition-builder-view');
                  const relationSelect = container.find('.js-relation-select');
                  if (relationSelect.val() != 0) {

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

                saveAndViewFilter() {
                    this.saveFilter()
                        .done(function (data) {
                            let response = data.result;
                            if (response && response.success) {

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

                      validateValue: function (fieldValue) {
                          let specialChars = /[&\<\>\:\'\"\,]/;
                          if (specialChars.test(fieldValue)) {
                              let errorInfo = app.vtranslate('JS_SPECIAL_CHARACTERS') + ' & < > \' " : , ' + app.vtranslate('JS_NOT_ALLOWED');
                              this.setError(errorInfo);
              public_html/layouts/basic/modules/Settings/LayoutEditor/resources/LayoutEditor.js on lines 2360..2369

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

              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

                              AppConnector.request({
                                  module: app.getModuleName(),
                                  parent: app.getParentModuleName(),
                                  view: 'ConditionBuilder',
                                  mode: 'builder',
              public_html/layouts/basic/modules/Settings/Countries/resources/Index.js on lines 109..134
              public_html/layouts/basic/modules/Settings/InterestsConflict/resources/Index.js on lines 51..63
              public_html/layouts/basic/modules/Settings/Mail/resources/List.js on lines 14..25
              public_html/layouts/basic/modules/Settings/ModuleManager/resources/ModuleManager.js on lines 59..76
              public_html/layouts/basic/modules/Settings/PublicHoliday/resources/PublicHoliday.js on lines 271..285
              public_html/layouts/basic/modules/Settings/RecordNumbering/resources/Index.js on lines 110..127
              public_html/layouts/basic/modules/Vtiger/resources/Detail.js on lines 156..165

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

                  registerChangeSelectedColumns() {
                      this.container.find('.js-view-columns-select').on('change', () => {
                          this.registerAppendCustomLabels();
                      });
                  }
              public_html/layouts/basic/modules/Calendar/resources/CalendarQuickCreate.js on lines 95..99
              public_html/layouts/basic/modules/OSSTimeControl/resources/QuickCreate.js on lines 85..89
              public_html/layouts/basic/modules/Occurrences/resources/QuickCreate.js on lines 85..89
              public_html/layouts/basic/modules/Reservations/resources/QuickCreate.js on lines 85..89

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

              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

                  getContentsContainer() {
                      if (!this.modalContainer) {
                          this.modalContainer = $('.js-filter-modal__container');
                      }
                      return this.modalContainer;
              public_html/layouts/basic/modules/CustomView/resources/CustomView.js on lines 62..67

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

              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

                  getColumnSelectElement() {
                      if (!this.columnSelectElement) {
                          this.columnSelectElement = $('#viewColumnsSelect');
                      }
                      return this.columnSelectElement;
              public_html/layouts/basic/modules/CustomView/resources/CustomView.js on lines 51..56

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

              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