Showing 4,652 of 306,333 total issues
Function getHierarchy
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getHierarchy(int $id, bool $getRawData = false, bool $getLinks = true): array
{
$listviewHeader = [];
$listviewEntries = [];
if ('Active' === \App\Record::getState($id)) {
- 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 initializeListViewContents
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function initializeListViewContents(App\Request $request, Vtiger_Viewer $viewer)
{
$moduleName = $request->getByType('forModule');
$cvId = $request->getByType('viewname', 2);
$pageNumber = $request->getInteger('page');
- 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 getRecordRelatedListViewLinksLeftSide
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getRecordRelatedListViewLinksLeftSide(Vtiger_RelationListView_Model $viewModel)
{
$links = parent::getRecordRelatedListViewLinksLeftSide($viewModel);
if (\App\Mail::checkMailClient()) {
if (\App\Mail::checkInternalMailClient()) {
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
public function process(App\Request $request)
{
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$widget = Vtiger_Widget_Model::getInstance($request->getInteger('linkid'), \App\User::getCurrentUserId());
- 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 getNextFile
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getNextFile($del = true)
{
$return = false;
foreach ($this->filelist as $name) {
$filePatch = $this->importFolderLocation . DIRECTORY_SEPARATOR . $name;
- 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
Method getHierarchyData
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function getHierarchyData($id, $iStorageInfoBase, $iStorageId, &$listviewEntries, $getRawData = false, $getLinks = true)
Function getImportRecordStatus
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getImportRecordStatus($value)
{
$temp_status = '';
switch ($value) {
case 'created':
- 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 post
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function post(): array
{
if (1 !== $this->getUserData('type')) {
foreach ($this->recordModel->getModule()->getFieldsByType('serverAccess') as $fieldName => $fieldModel) {
if ($fieldModel->getFieldParams() == $this->getUserData('server_id')) {
- 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 getById
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getById($id)
{
$this->getStatuses();
$projects = $this->getProject($id);
$title = '';
- 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
Method getHierarchyData
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function getHierarchyData(int $id, array $baseInfo, int $recordId, array &$listviewEntries, bool $getRawData = false, bool $getLinks = true): array
Avoid deeply nested control flow statements. Open
if ($isRawData) {
if ($isCreate) {
$data[$fieldName]['raw'] = $fieldModel->get('postvalue');
} else {
$data[$fieldName]['rawFrom'] = $fieldModel->get('prevalue');
Function __construct
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function __construct($message, $code = 500, \Throwable $previous = null)
{
$message = rtrim(str_replace(ROOT_DIRECTORY . \DIRECTORY_SEPARATOR, '', $message), PHP_EOL);
if (!empty($previous)) {
parent::__construct($message, $code, $previous);
- 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 get
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function get(): array
{
$this->createQuery();
$limit = $this->queryGenerator->getLimit();
$isRawData = $this->isRawData();
- 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 get
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function get(App\Request $request)
{
if (!\App\RequestUtil::isNetConnection()) {
$this->error();
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
Consider simplifying this complex logical expression. Open
*/_search:function _search(params){var aDeferred=jQuery.Deferred();if("undefined"==typeof params&&(params={}),params.module=params.searchModule&&"-"!==params.searchModule?params.searchModule:app.getModuleName(),params.view="BasicAjax",params.mode="showSearchResults",params.limit=this.reduceNumberResults,params.html=this.returnHtml,app.getParentModuleName()&&(params.parent=app.getParentModuleName()),params.operator=CONFIG.globalSearchDefaultOperator,this.mainContainer){var operatorElement=this.mainContainer.find(".js-global-search-operator .active[data-operator]");operatorElement.length&&""!=operatorElement.data("operator")&&(params.operator=operatorElement.data("operator"));}return AppConnector.request(params).done(function(data){aDeferred.resolve(data);}).fail(function(error){aDeferred.reject(error);}),aDeferred.promise()},/**
Consider simplifying this complex logical expression. Open
if (
(this.listViewContentContainer != false &&
this.listViewContentContainer.length != 0 &&
this.listViewContentContainer.find('#selectedIds').length == 0) ||
((this.listViewContentContainer == false || this.listViewContentContainer.length == 0) &&
Consider simplifying this complex logical expression. Open
} else if (
typeof from[key] === 'object' &&
from[key] !== null &&
(!to.hasOwnProperty(key) || (typeof to[key] === 'object' && to[key] !== null && !Array.isArray(to[key])))
) {
Consider simplifying this complex logical expression. Open
if (
(app.getViewName() === 'Detail' || (app.getViewName() === 'Edit' && app.getRecordId() !== undefined)) &&
app.getParentModuleName() != 'Settings' &&
(!params['data'] || !('sourceModule' in params['data']))
) {
Consider simplifying this complex logical expression. Open
if (
(ranges.length === 2 && (strippedValue > parseFloat(ranges[1]) || strippedValue < parseFloat(ranges[0]))) ||
(ranges.length === 1 && (strippedValue > parseFloat(ranges[0]) || strippedValue < 0))
) {
errorInfo = app.vtranslate('JS_ERROR_MAX_VALUE');
Consider simplifying this complex logical expression. Open
if (($arrInput = \explode(' ', $input)) && 2 === \count($arrInput)) {
[$dateInput, $timeInput] = $arrInput;
[$y, $m, $d] = Fields\Date::explode($dateInput);
$result = checkdate($m, $d, $y) && is_numeric($y) && is_numeric($m) && is_numeric($d)
&& preg_match('/(2[0-3]|[0][0-9]|1[0-9]):([0-5][0-9]):([0-5][0-9])/', $timeInput);