YetiForceCompany/YetiForceCRM

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

Summary

Maintainability
F
4 days
Test Coverage

File Header.js has 501 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: Major
Found in public_html/layouts/basic/modules/Vtiger/resources/Header.js - About 1 day to fix

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

        {
            menuContainer: false,
            contentContainer: false,
            init: function () {
                this.setContentsContainer('.js-base-container');
    Severity: Minor
    Found in public_html/layouts/basic/modules/Vtiger/resources/Header.js - About 3 hrs to fix

      Function basicSearch has 76 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              basicSearch: function () {
                  let thisInstance = this;
                  $('.js-global-search__value').on('keypress', function (e) {
                      let currentTarget = $(e.currentTarget);
                      if (e.which == 13) {
      Severity: Major
      Found in public_html/layouts/basic/modules/Vtiger/resources/Header.js - About 3 hrs to fix

        Function registerMobileEvents has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                registerMobileEvents: function () {
                    const self = this,
                        container = this.getContentsContainer();
                    $('.rightHeaderBtnMenu').on('click', function () {
                        self.hideActionMenu();
        Severity: Major
        Found in public_html/layouts/basic/modules/Vtiger/resources/Header.js - About 2 hrs to fix

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

                  registerEvents: function () {
                      let thisInstance = this;
                      const container = thisInstance.getContentsContainer(),
                          menuContainer = container.find('.js-menu--scroll'),
                          quickCreateModal = container.find('.quickCreateModules');
          Severity: Minor
          Found in public_html/layouts/basic/modules/Vtiger/resources/Header.js - About 1 hr to fix

            Function showAnnouncement has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    showAnnouncement: function () {
                        let thisInstance = this;
                        let announcementContainer = $('#announcements');
                        let announcements = announcementContainer.find('.announcement');
                        if (announcements.length > 0) {
            Severity: Minor
            Found in public_html/layouts/basic/modules/Vtiger/resources/Header.js - About 1 hr to fix

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

                          remindersNotice.on('click', function () {
                              if (!remindersNotice.hasClass('autoRefreshing')) {
                                  Vtiger_Index_Js.requestReminder();
                              }
                              self.hideActionMenu();
              Severity: Major
              Found in public_html/layouts/basic/modules/Vtiger/resources/Header.js and 1 other location - About 3 hrs to fix
              public_html/layouts/basic/modules/Vtiger/resources/Header.js on lines 276..286

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

              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

                          remindersNotice.on('click', function () {
                              if (!remindersNotice.hasClass('autoRefreshing')) {
                                  Vtiger_Index_Js.getNotificationsForReminder();
                              }
                              self.hideActionMenu();
              Severity: Major
              Found in public_html/layouts/basic/modules/Vtiger/resources/Header.js and 1 other location - About 3 hrs to fix
              public_html/layouts/basic/modules/Vtiger/resources/Header.js on lines 259..269

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

              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

                                  _renderMenu: function (ul, items) {
                                      let that = this,
                                          currentCategory = '';
                                      $.each(items, function (index, item) {
                                          if (item.category != currentCategory) {
              Severity: Major
              Found in public_html/layouts/basic/modules/Vtiger/resources/Header.js and 1 other location - About 3 hrs to fix
              public_html/layouts/basic/modules/Calendar/resources/Edit.js on lines 507..517

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

              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

                              $('.quickCreateModules .js-quickcreate-search-item a').filter(function () {
                                  let item = $(this).closest('.js-quickcreate-search-item');
                                  if ($(this).text().toLowerCase().indexOf(value) > -1) {
                                      item.removeClass('d-none');
                                  } else {
              Severity: Major
              Found in public_html/layouts/basic/modules/Vtiger/resources/Header.js and 1 other location - About 2 hrs to fix
              public_html/layouts/basic/modules/Settings/YetiForce/resources/Shop.js on lines 36..43

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

              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