YetiForceCompany/YetiForceCRM

View on GitHub

Showing 4,652 of 306,333 total issues

Function post has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    public function post(): array
    {
        if ($result = $this->checkBeforeSave()) {
            return $result;
        }
Severity: Minor
Found in api/webservice/WebservicePremium/BaseModule/SaveInventory.php - 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

Function get has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    public function get(): array
    {
        $displayData = $fieldsLabel = [];
        $moduleName = $this->controller->request->get('module');
        $setRawData = 1 === (int) ($this->controller->headers['x-raw-data'] ?? 0);
Severity: Minor
Found in api/webservice/WebserviceStandard/BaseModule/Record.php - 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

Method record has 93 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function record($params, $isPermitted = true)
    {
        if (!isset($this->recordModel) || ($isPermitted && !Privilege::isPermitted($this->moduleName, 'DetailView', $this->record))) {
            return '';
        }
Severity: Major
Found in app/TextParser.php - About 3 hrs to fix

    Function registerEditFieldDetailsClick has 92 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            registerEditFieldDetailsClick: function (contents) {
                var thisInstance = this;
                if (typeof contents === 'undefined') {
                    contents = this.container.find('.contents');
                }

      Function getValues has 92 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              getValues: function () {
                  const thisInstance = this,
                      filterContainer = this.getFilterContainer();
      
                  let fieldList = ['columnname', 'comparator', 'value', 'valuetype', 'column_condition'],
      Severity: Major
      Found in public_html/layouts/basic/modules/Vtiger/resources/AdvanceFilterEx.js - About 3 hrs to fix

        File Watchdog.php has 320 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
         * YetiForce watchdog class.
         * Modifying this file or functions that affect the footer appearance will violate the license terms!!!
         *
        Severity: Minor
        Found in app/YetiForce/Watchdog.php - About 3 hrs to fix

          Method save has 92 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function save(App\Request $request): void
              {
                  $fieldId = $request->getInteger('fieldid');
                  if (empty($fieldId)) {
                      throw new \App\Exceptions\AppException('Empty field ID: ' . $fieldId);
          Severity: Major
          Found in modules/Settings/LayoutEditor/actions/Field.php - About 3 hrs to fix

            Method save has 92 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function save()
                {
                    $db = App\Db::getInstance();
                    $roleId = $this->getId();
                    $mode = 'edit';
            Severity: Major
            Found in modules/Settings/Roles/models/Record.php - About 3 hrs to fix

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

                  public function process(App\Request $request)
                  {
                      $this->preProcess($request);
                      $viewer = $this->getViewer($request);
                      $pdfModuleName = $moduleName = $request->getModule();
              Severity: Major
              Found in modules/Vtiger/views/PDF.php - About 3 hrs to fix

                Settings_Workflows_Record_Model has 30 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class Settings_Workflows_Record_Model extends Settings_Vtiger_Record_Model
                {
                    /**
                     * Get record id.
                     *
                Severity: Minor
                Found in modules/Settings/Workflows/models/Record.php - About 3 hrs to fix

                  Function getValues has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          getValues: function () {
                              const thisInstance = this;
                              let fieldList = new Array('columnname', 'comparator', 'value', 'valuetype', 'column_condition'),
                                  values = {},
                                  columnIndex = 0,

                    Method getRates has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function getRates($otherCurrencyCode, $dateParam, $cron = false)
                        {
                            $moduleModel = Settings_CurrencyUpdate_Module_Model::getCleanInstance();
                            $selectedBank = $moduleModel->getActiveBankId();
                            $yesterday = date('Y-m-d', strtotime('-1 day'));
                    Severity: Major
                    Found in modules/Settings/CurrencyUpdate/bankmodels/NBR.php - About 3 hrs to fix

                      Method entityAfterSave has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function entityAfterSave(App\EventHandler $eventHandler)
                          {
                              if (!ModTracker::isTrackingEnabledForModule($eventHandler->getModuleName())) {
                                  return false;
                              }
                      Severity: Major
                      Found in modules/ModTracker/handlers/ModTrackerHandler.php - About 3 hrs to fix

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

                            public function process(App\Request $request)
                            {
                                $viewer = $this->getViewer($request);
                                $moduleName = $request->getModule();
                                $recordId = $request->getInteger('record');
                        Severity: Major
                        Found in modules/Vtiger/views/Edit.php - About 3 hrs to fix

                          File ModuleHierarchy.php has 318 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          <?php
                          
                          namespace App;
                          
                          /**
                          Severity: Minor
                          Found in app/ModuleHierarchy.php - About 3 hrs to fix

                            File WebserviceStandard.php has 317 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            <?php
                            
                            /**
                             * WebserviceStandard Record Model file.
                             *
                            Severity: Minor
                            Found in modules/Settings/WebserviceUsers/services/WebserviceStandard.php - About 3 hrs to fix

                              Function registerSearchAddress has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      registerSearchAddress: function () {
                                          const searchValue = this.container.find('.js-search-address'),
                                              searchBtn = this.container.find('.js-search-btn'),
                                              operator = this.container.find('.js-select-operator');
                                          if (operator.length && operator.val()) {
                              Severity: Major
                              Found in public_html/layouts/basic/modules/OpenStreetMap/resources/Map.js - About 3 hrs to fix

                                Method getRates has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function getRates($otherCurrencyCode, $dateParam, $cron = false)
                                    {
                                        $moduleModel = Settings_CurrencyUpdate_Module_Model::getCleanInstance();
                                        $selectedBank = $moduleModel->getActiveBankId();
                                        $yesterday = date('Y-m-d', strtotime('-1 day'));
                                Severity: Major
                                Found in modules/Settings/CurrencyUpdate/bankmodels/ECB.php - About 3 hrs to fix

                                  Function initEditView has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      initEditView: function () {
                                          function toggleEditViewTableRow(e) {
                                              var target = jQuery(e.currentTarget);
                                              var container = jQuery('[data-togglecontent="' + target.data('togglehandler') + '"]');
                                              var closestTrElement = container.closest('tr');

                                  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 loadConditions has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                          loadConditions: function (fieldSelect) {
                                              let row = fieldSelect.closest('div.js-conditions-row');
                                              let conditionSelectElement = row.find('select[name="comparator"]');
                                              let conditionSelected = conditionSelectElement.val();
                                              let fieldSelected = fieldSelect.find('option:selected');

                                  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