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
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)]))
)
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);
}
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))
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')
)
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
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());
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()
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;
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);
}
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()) {
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());
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];
}
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)) {
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) {
- Read upRead up
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 {
- Read upRead up
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) {
- Read upRead up
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;
- Read upRead up
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);
- Read upRead up
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')) {
- Read upRead up
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"