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());
- 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 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();
- 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 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])) {
- 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 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();
- 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 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()) {
- 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 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);
- 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 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;
}
- 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 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 '';
- 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 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) {
- 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 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;
- 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 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');
- 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 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);
- 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 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();
- 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
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.
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);
}
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'));
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;
Method getWidgetTimeControl
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getWidgetTimeControl($user, $date)
{
if (!$date) {
return ['show_chart' => false];
}
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('');