YetiForceCompany/YetiForceCRM

View on GitHub

Showing 4,652 of 306,333 total issues

Method registerHandler has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public static function registerHandler(string $eventName, string $className, $includeModules = '', $excludeModules = '', $priority = 5, $isActive = true, $ownerId = 0, $mode = 1): bool
Severity: Major
Found in app/EventHandler.php - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

                if ($skipEmpty && $this->recordModel && !(($relId = $this->recordModel->get($field->getName()))
                    && (
                        \in_array($field->getFieldDataType(), ['userCreator', 'owner', 'sharedOwner'])
                        || ((Record::isExists($relId)) && ($relRecord = \Vtiger_Record_Model::getInstanceById($relId))->isViewable() && ($relatedModules = [Record::getType($relId)]))
                    )
    Severity: Major
    Found in app/TextParser.php - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

              if ($this->getId() && !\in_array($key, ['id']) && ($propertyExists && $this->{$key} !== $value && (null !== $this->{$key} || '' !== $value)) && !\array_key_exists($key, $this->changes)) {
                  $this->changes[$key] = $this->get($key);
              }
      Severity: Major
      Found in app/Fields/Picklist/Item.php - About 1 hr to fix

        Consider simplifying this complex logical expression.
        Open

                    if ($referenceFieldModel
                        && $relatedModuleModel->isActive()
                        && $relatedApproveModel->isActive()
                        && ($relationModel = \Vtiger_Relation_Model::getInstance($recordModel->getModule(), $relatedModuleModel))
                        && ($relationApproveModel = \Vtiger_Relation_Model::getInstance($relatedApproveModel, $relatedModuleModel))
        Severity: Major
        Found in modules/ApprovalsRegister/models/Module.php - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                  if (!(
                          4 === $fieldModel->getDisplayType() || \in_array($fieldModel->get('presence'), [1, 3])
                          || 5 === $fieldModel->getDisplayType() || 0 === strcasecmp($fieldModel->getFieldDataType(), 'autogenerated')
                          || 0 === strcasecmp($fieldModel->getFieldDataType(), 'id')
                      )
          Severity: Major
          Found in modules/Settings/Profiles/models/Record.php - About 1 hr to fix

            Consider simplifying this complex logical expression.
            Open

                        if ($rolePreviousData['listrelatedrecord'] != $this->get('listrelatedrecord')
                                || $rolePreviousData['previewrelatedrecord'] != $this->get('previewrelatedrecord')
                                || $rolePreviousData['editrelatedrecord'] != $this->get('editrelatedrecord')
                                || $rolePreviousData['permissionsrelatedfield'] != $permissionsRelatedField
                                || $rolePreviousData['searchunpriv'] != $searchunpriv
            Severity: Major
            Found in modules/Settings/Roles/models/Record.php - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

                      if ($resultField && ($purchaseField = $recordModel->getField('purchase')) && $purchaseField->isActiveField()
                          && ($marginField = $recordModel->getField('commissionrate')) && $marginField->isActiveField()
                          && ($unitPriceField = $recordModel->getField('unit_price')) && $unitPriceField->isActiveField()) {
                          $uiTypeModel = $unitPriceField->getName() === $resultField ? $purchaseField->getUITypeModel() : $unitPriceField->getUITypeModel();
                          $value = $recordModel->get($uiTypeModel->getFieldModel()->getName());
              Severity: Major
              Found in modules/Products/handlers/Calculations.php - About 1 hr to fix

                Consider simplifying this complex logical expression.
                Open

                            if ($contactModel->getName() === $relatedModuleModel->getName() && $contactModel->isActive()
                                && $contactModel->isPermitted('CreateView') && $contactModel->isPermitted('Import')
                                && $relationModelInstance->isAddActionSupported()
                                && $this->getParentRecordModel()->isViewable()
                                && $relationModelInstance->getParentModuleModel()->getName() === $this->getParentRecordModel()->getModuleName()
                Severity: Major
                Found in modules/Occurrences/models/RelationListView.php - About 1 hr to fix

                  Consider simplifying this complex logical expression.
                  Open

                          if (
                              !$this->isViewEnabled() || !$this->isActiveReference()
                              || ((306 === $this->get('uitype') || 307 === $this->get('uitype') || 311 === $this->get('uitype') || 312 === $this->get('uitype')) && 2 === $this->getDisplayType())
                          ) {
                              $return = false;
                  Severity: Major
                  Found in modules/Vtiger/models/Field.php - About 1 hr to fix

                    Consider simplifying this complex logical expression.
                    Open

                                if (5 !== \count($item) || empty($item['key']) || empty($item['name']) || empty($item['size']) || empty($item['path']) || !\array_key_exists('type', $item) || 50 !== App\TextUtils::getTextLength($item['key'])) {
                                    throw new \App\Exceptions\Security('ERR_ILLEGAL_FIELD_VALUE||' . $this->getFieldModel()->getName() . '||' . $this->getFieldModel()->getModuleName() . '||' . \App\Json::encode($value), 406);
                                }
                    Severity: Major
                    Found in modules/Vtiger/uitypes/MultiAttachment.php - About 1 hr to fix

                      Consider simplifying this complex logical expression.
                      Open

                              if (!$this->isViewEnabled() || 4 === $displayType || 5 === $displayType
                                  || 0 === strcasecmp($this->getFieldDataType(), 'autogenerated')
                                  || 0 === strcasecmp($this->getFieldDataType(), 'id')
                                  || true === $this->isReadOnly()
                                  || !$this->getUITypeModel()->isWritable()) {
                      Severity: Major
                      Found in modules/Vtiger/models/Field.php - About 1 hr to fix

                        Consider simplifying this complex logical expression.
                        Open

                                if ($returnVal && $this->getRelationType() === static::RELATION_O2M && ($fieldModel = $this->getRelationField())) {
                                    if (!$recordModel && $recordId) {
                                        $recordModel = \Vtiger_Record_Model::getInstanceById($recordId);
                                    }
                                    $returnVal = !$fieldModel->isMandatory() && $fieldModel->isEditable() && !$fieldModel->isEditableReadOnly() && (!$recordModel || $recordModel->isEditable());
                        Severity: Major
                        Found in modules/Vtiger/models/Relation.php - About 1 hr to fix

                          Consider simplifying this complex logical expression.
                          Open

                                                              if ('' === $fieldValue && '' !== $currentValue && null !== $currentValue) {
                                                                  $forUnset[] = $fieldName;
                                                              } elseif ('' === $fieldValue && ('' === $currentValue || null === $currentValue) && isset($defaultMandatoryFieldValues[$fieldName]) && '' !== $defaultMandatoryFieldValues[$fieldName]) {
                                                                  $fieldValue = $defaultMandatoryFieldValues[$fieldName];
                                                              }
                          Severity: Major
                          Found in modules/Import/actions/Data.php - About 1 hr to fix

                            Consider simplifying this complex logical expression.
                            Open

                                    if (0 === \App\ModuleHierarchy::getModuleLevel($moduleName)) {
                                        $where[] = ["{$moduleModel->basetable}.{$moduleModel->basetableid}" => $parentId];
                                    } elseif (\in_array($moduleName, ['Products', 'Services'])) {
                                        // exception
                                    } elseif ('ModComments' !== $moduleName && $fieldsForParent = $moduleModel->getReferenceFieldsForModule($parentModule)) {
                            Severity: Major
                            Found in api/webservice/WebservicePremium/PrivilegeQuery.php - About 1 hr to fix

                              Function deleteRecord has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                      deleteRecord: function (deleteRecordActionUrl) {
                                          app.showConfirmModal({
                                              title: app.vtranslate('JS_DELETE_USER_CONFIRMATION'),
                                              confirmedCallback: () => {
                                                  AppConnector.request(deleteRecordActionUrl).done(function (data) {
                              Severity: Minor
                              Found in public_html/layouts/basic/modules/Users/resources/List.js - About 55 mins 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 validationFileZipPath has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                      validationFileZipPath: function (form) {
                                          form.on('submit', function (e) {
                                              if (typeof form.data('submit') !== 'undefined') {
                                                  return false;
                                              } else {

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

                                      triggerDeleteUser: function (deleteUserUrl) {
                                          app.showConfirmModal({
                                              title: app.vtranslate('JS_DELETE_USER_CONFIRMATION'),
                                              confirmedCallback: () => {
                                                  AppConnector.request(deleteUserUrl).done(function (data) {
                              Severity: Minor
                              Found in public_html/layouts/basic/modules/Users/resources/Detail.js - About 55 mins 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 getUi has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                      getUi: function () {
                                          let comparatorSelectedOptionVal = this.get('comparatorElementVal'),
                                              dateSpecificConditions = this.get('dateSpecificConditions'),
                                              html,
                                              element;

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

                                      registerPopUpSaveEvent: function (data, fieldUiHolder) {
                                          jQuery('[name="saveButton"]', data).on('click', function (e) {
                                              var valueType = jQuery('.textType', data).val();
                              
                                              fieldUiHolder.find('[name="valuetype"]').val(valueType);
                              Severity: Minor
                              Found in public_html/layouts/basic/modules/Settings/Workflows/resources/Edit.js - About 55 mins 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 registerChangeVal has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                      registerChangeVal: function ($container) {
                                          $container.on('change', 'select', (e) => {
                                              let $target = $(e.currentTarget);
                                              let isMultiple = $target.attr('multiple');
                                              if ($target.validationEngine('validate')) {
                              Severity: Minor
                              Found in public_html/layouts/basic/modules/Settings/Inventory/resources/Config.js - About 55 mins 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