YetiForceCompany/YetiForceCRM

View on GitHub

Showing 4,652 of 306,333 total issues

Function validateHeaderCsp has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    private static function validateHeaderCsp(string $name, array $row, string $sapi)
    {
        unset($sapi);
        $header = strtolower(\str_replace('Header: ', '', $name));
        $row['recommended'] = trim(\App\Controller\Headers::getInstance()->getCspHeader());
Severity: Minor
Found in app/Utils/ConfReport.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 setValuesForRecord has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public function setValuesForRecord(\Vtiger_Record_Model $record): void
    {
        $this->record = $record;
        if (isset($this->card->N)) {
            $head = $this->card->N->getParts();
Severity: Minor
Found in app/Integrations/Dav/Card.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 getCombinedUserActionsPermissions has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getCombinedUserActionsPermissions($userId)
    {
        $profiles = static::getProfilesByUser($userId);
        $actionPermissions = [];
        if (isset($profiles[0])) {
Severity: Minor
Found in app/PrivilegeUtil.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 enableOrDisableValuesForRole has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public function enableOrDisableValuesForRole($picklistFieldName, $valuesToEnables, $valuesToDisable, $roleIdList)
    {
        $db = App\Db::getInstance();
        $picklistId = (new App\Db\Query())->select(['picklistid'])->from('vtiger_picklist')
            ->where(['name' => $picklistFieldName])->scalar();
Severity: Minor
Found in modules/Settings/Picklist/models/Module.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 getStructure has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public function getStructure(string $moduleName = null, ?string $referenceFieldName = null): array
    {
        $structures = [];
        foreach (\Vtiger_Module_Model::getInstance($moduleName)->getFields() as $fieldModel) {
            if ($fieldModel->isViewable() && $fieldModel->isListviewSortable()) {
Severity: Minor
Found in modules/Settings/CustomView/views/SortOrderModal.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 getSearchComments has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getSearchComments(int $parentId, $moduleName, string $searchValue, bool $isWidget, array $hierarchy = [], Vtiger_Paging_Model $pagingModel = null)
    {
        $fields = array_merge(array_keys(\App\Field::getModuleFieldInfosByPresence('ModComments')), ['id']);
        $queryGenerator = new \App\QueryGenerator('ModComments');
        $queryGenerator->setFields($fields);
Severity: Minor
Found in modules/ModComments/models/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

Function findEmail has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public function findEmail(int $record, string $module): string
    {
        if (!\App\Record::isExists($record)) {
            return false;
        }
Severity: Minor
Found in modules/OSSMailView/models/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

Function getDisplayValue has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public function getDisplayValue($value, $record = false, $recordModel = false, $rawText = false, $length = false)
    {
        $isAdmin = \App\User::getCurrentUserModel()->isAdmin();
        if (empty($value)) {
            return '';
Severity: Minor
Found in modules/Vtiger/uitypes/SharedOwner.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 addRelations has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public function addRelations(): void
    {
        $recordId = $this->getId();
        if (isset($this->ext['relations']) && \is_array($this->ext['relations'])) {
            foreach ($this->ext['relations'] as $value) {
Severity: Minor
Found in modules/Vtiger/models/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

Function sanitizeInventoryValues has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public function sanitizeInventoryValues(array $inventoryRow, array $inventoryFields): array
    {
        ++$this->invNo;
        $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, $this->invNo, \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC);
        ++$this->colNo;
Severity: Minor
Found in modules/Vtiger/models/ExportToSpreadsheet.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 process has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public function process(App\Request $request)
    {
        $records = $request->getArray('records', 'Integer');
        $moduleName = $request->getModule();
        $template = $request->getInteger('template');
Severity: Minor
Found in modules/Vtiger/actions/GenerateRecords.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 createTable has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public function createTable()
    {
        $db = \App\Db::getInstance();
        $schema = $db->getSchema();
        $tableName = Import_Module_Model::getDbTableName($this->user);
Severity: Minor
Found in modules/Import/readers/FileReader.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 transformInventoryForImport has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public function transformInventoryForImport($inventoryData)
    {
        $inventoryModel = Vtiger_Inventory_Model::getInstance($this->module);
        $inventoryFields = $inventoryModel->getFields();
        $maps = $inventoryModel->getAutoCompleteFields();
Severity: Minor
Found in modules/Import/actions/Data.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

File List.js has 302 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/Users/resources/List.js - About 3 hrs to fix

    Function checkPrefix has 81 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            checkPrefix() {
                let sequenceExists = false;
                const editViewForm = this.getForm();
                const value = editViewForm.find('[name="reset_sequence"]').val();
                const prefix = editViewForm.find('[name="prefix"]').val();

      Method getConditions has 81 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function getConditions($id): array
          {
              if (Cache::has('CustomView_GetConditions', $id)) {
                  return Cache::get('CustomView_GetConditions', $id);
              }
      Severity: Major
      Found in app/CustomView.php - About 3 hrs to fix

        Method getRates has 81 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/NBP.php - About 3 hrs to fix

          Method addWidget has 81 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function addWidget($data, $moduleName, $addToUser = false)
              {
                  \App\Log::trace('Entering Settings_WidgetsManagement_Module_Model::addWidget(' . $moduleName . ') method ...');
                  $db = App\Db::getInstance();
                  $status = false;
          Severity: Major
          Found in modules/Settings/WidgetsManagement/models/Module.php - About 3 hrs to fix

            Method getWidgetTimeControl has 81 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getWidgetTimeControl($user, $date)
                {
                    if (!$date) {
                        return ['show_chart' => false];
                    }
            Severity: Major
            Found in modules/OSSTimeControl/dashboards/TimeControl.php - About 3 hrs to fix

              Function registerBankChange has 80 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      registerBankChange: function (container) {
                          container.find('#bank').on('change', function () {
                              let bankName = container.find('#bank option:selected').data('name');
                              container.find('#alertSpan').html('');
                              container.find('#infoSpan').html('');
                Severity
                Category
                Status
                Source
                Language