YetiForceCompany/YetiForceCRM

View on GitHub

Showing 4,652 of 306,333 total issues

Function getUsersByGroup has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getUsersByGroup($groupId, $subGroups = false, $i = 0)
    {
        $cacheKey = $groupId . (false === $subGroups ? '' : '#');
        if (Cache::has('getUsersByGroup', $cacheKey)) {
            return Cache::get('getUsersByGroup', $cacheKey);
Severity: Minor
Found in app/PrivilegeUtil.php - About 4 hrs 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

Function getMenu has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getMenu(string $moduleName, string $view, string $mode = '', &$selected = null): array
    {
        $selectedFieldId = 0;
        $selectedBlockId = 0;
        $menu = [];
Severity: Minor
Found in modules/Settings/Vtiger/models/Menu.php - About 4 hrs 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

Function setFieldMapping has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    public function setFieldMapping($fieldValueMapping, $recordModel, $parentRecordModel)
    {
        $ownerFields = [];
        $entityType = $this->entity_type;
        foreach ($recordModel->getModule()->getFields() as $name => $fieldModel) {
Severity: Minor
Found in modules/com_vtiger_workflow/tasks/VTCreateEntityTask.php - About 4 hrs 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

Function loadFieldInfo has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    public function loadFieldInfo(): array
    {
        if (null !== $this->fieldInfo) {
            return $this->fieldInfo;
        }
Severity: Minor
Found in modules/Vtiger/models/Field.php - About 4 hrs 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

Function getTicketsByStatus has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    public function getTicketsByStatus($owner)
    {
        $moduleName = 'HelpDesk';
        $ticketStatus = Settings_SupportProcesses_Module_Model::getTicketStatusNotModify();
        $query = new \App\Db\Query();
Severity: Minor
Found in modules/HelpDesk/dashboards/TicketsByStatus.php - About 4 hrs 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

Function transformInventoryFieldFromMap has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    public function transformInventoryFieldFromMap($value, $mapData)
    {
        if (!empty($value)) {
            if ($this->currentInventoryRawData['name']) {
                [$entityName] = $this->transformInventoryReference($this->currentInventoryRawData['name'], true);
Severity: Minor
Found in modules/Import/actions/Data.php - About 4 hrs 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

Function registerUnlock has 102 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        registerUnlock: function (container) {
            let form = container.find('.js-filter-form');
            App.Fields.Date.registerRange(form);
            let table = $('#js-unlock-table');
            if (table.hasClass('dataTable')) {
Severity: Major
Found in public_html/layouts/basic/components/InterestsConflict.js - About 4 hrs to fix

    Method exportFields has 102 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function exportFields(ModuleBasic $moduleInstance, $blockid)
        {
            $dataReader = (new \App\Db\Query())->from('vtiger_field')->where(['tabid' => $moduleInstance->id, 'block' => $blockid])->createCommand()->query();
            if (0 === $dataReader->count()) {
                return;
    Severity: Major
    Found in vtlib/Vtiger/PackageExport.php - About 4 hrs to fix

      Method addField has 102 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function addField($fieldType, $blockId, $params)
          {
              $label = $params['fieldLabel'];
              $name = strtolower($params['fieldName']);
              $pickListValues = [];
      Severity: Major
      Found in modules/Settings/LayoutEditor/models/Module.php - About 4 hrs to fix

        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',

          File Rule.php has 334 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          /**
           * Settings SharingAccess rule model class.
           *
           * @copyright YetiForce S.A.
          Severity: Minor
          Found in modules/Settings/SharingAccess/models/Rule.php - About 4 hrs to fix

            Calendar_Js has 32 functions (exceeds 20 allowed). Consider refactoring.
            Open

            window.Calendar_Js = class {
                static monthFormat = {
                    'yyyy-mm-dd': 'YYYY-MMMM',
                    'mm-dd-yyyy': 'MMMM-YYYY',
                    'dd-mm-yyyy': 'MMMM-YYYY',
            Severity: Minor
            Found in public_html/layouts/resources/Calendar.js - About 4 hrs to fix

              CustomView has 32 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class CustomView
              {
                  const CV_STATUS_DEFAULT = 0;
                  const CV_STATUS_PRIVATE = 1;
                  const CV_STATUS_PENDING = 2;
              Severity: Minor
              Found in app/CustomView.php - About 4 hrs to fix

                Request has 32 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class Request
                {
                    /**
                     * Raw request data.
                     *
                Severity: Minor
                Found in app/Request.php - About 4 hrs to fix

                  Vtiger_Widget_Model has 32 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Vtiger_Widget_Model extends \App\Base
                  {
                      /** @var array Default labels */
                      const DEFAULT_LABELS = [
                          'Activities' => 'LBL_ACTIVITIES',
                  Severity: Minor
                  Found in modules/Vtiger/models/Widget.php - About 4 hrs to fix

                    Function loadFieldSpecificUi has 99 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            loadFieldSpecificUi: function (fieldSelect) {
                                const selectedOption = fieldSelect.find('option:selected');
                                const row = fieldSelect.closest('div.js-conditions-row');
                                const fieldUiHolder = row.find('.fieldUiHolder');
                                const conditionSelectElement = row.find('select[name="comparator"]');
                    Severity: Major
                    Found in public_html/layouts/basic/modules/Vtiger/resources/AdvanceFilter.js - About 3 hrs to fix

                      Method getTimeZones has 98 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public static function getTimeZones()
                          {
                              return [
                                  'Pacific/Midway',
                                  'Pacific/Samoa',
                      Severity: Major
                      Found in modules/Users/UserTimeZonesArray.php - About 3 hrs to fix

                        Method imapConnect has 98 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public static function imapConnect($user, $password, $host = '', $folder = 'INBOX', $dieOnError = true, $config = [], array $account = [])
                            {
                                \App\Log::trace("Entering OSSMail_Record_Model::imapConnect($user , '****' , $folder) method ...");
                                if (!$config) {
                                    $config = self::loadRoundcubeConfig();
                        Severity: Major
                        Found in modules/OSSMail/models/Record.php - About 3 hrs to fix

                          Method process has 98 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function process(App\Request $request)
                              {
                                  $userId = \App\User::getCurrentUserId();
                                  $viewer = $this->getViewer($request);
                                  $moduleName = $request->getModule();
                          Severity: Major
                          Found in modules/OSSMailView/dashboards/Graf.php - About 3 hrs to fix

                            Function copySelectedOptions has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                            Open

                                    copySelectedOptions: function (source, destination) {
                                        let srcObj = jQuery(source);
                                        let destObj = jQuery(destination);
                            
                                        if (typeof srcObj === 'undefined' || typeof destObj === 'undefined') return;
                            Severity: Minor
                            Found in public_html/layouts/basic/modules/Import/resources/Import.js - About 3 hrs 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

                            Severity
                            Category
                            Status
                            Source
                            Language