YetiForceCompany/YetiForceCRM

View on GitHub

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)) {
Severity: Minor
Found in modules/HelpDesk/models/Module.php - About 45 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 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');
Severity: Minor
Found in modules/Import/views/List.php - About 45 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 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()) {
Severity: Minor
Found in modules/Contacts/models/Record.php - About 45 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 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());
Severity: Minor
Found in modules/HelpDesk/dashboards/TicketsByStatus.php - About 45 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 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;
Severity: Minor
Found in modules/Import/readers/ZipReader.php - About 45 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

Method getHierarchyData has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function getHierarchyData($id, $iStorageInfoBase, $iStorageId, &$listviewEntries, $getRawData = false, $getLinks = true)
Severity: Minor
Found in modules/IStorages/IStorages.php - About 45 mins to fix

    Function getImportRecordStatus has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getImportRecordStatus($value)
        {
            $temp_status = '';
            switch ($value) {
                case 'created':
    Severity: Minor
    Found in modules/Import/actions/Data.php - About 45 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 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')) {
    Severity: Minor
    Found in api/webservice/WebserviceStandard/Users/Record.php - About 45 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 getById has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getById($id)
        {
            $this->getStatuses();
            $projects = $this->getProject($id);
            $title = '';
    Severity: Minor
    Found in modules/Project/models/Gantt.php - About 45 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

    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
    Severity: Minor
    Found in modules/Project/Project.php - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                  if ($isRawData) {
                                      if ($isCreate) {
                                          $data[$fieldName]['raw'] = $fieldModel->get('postvalue');
                                      } else {
                                          $data[$fieldName]['rawFrom'] = $fieldModel->get('prevalue');
      Severity: Major
      Found in api/webservice/WebserviceStandard/BaseModule/RecordHistory.php - About 45 mins to fix

        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);
        Severity: Minor
        Found in api/webservice/Core/Exception.php - About 45 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 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();
        Severity: Minor
        Found in api/webservice/WebserviceStandard/BaseModule/RecordsList.php - About 45 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 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;
        Severity: Minor
        Found in modules/OpenStreetMap/files/TileLayer.php - About 45 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

        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()},/**
        Severity: Major
        Found in public_html/layouts/basic/modules/Vtiger/resources/BasicSearch.min.js - About 40 mins to fix

          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) &&
          Severity: Major
          Found in public_html/layouts/basic/modules/Vtiger/resources/List.js - About 40 mins to fix

            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])))
                                ) {
            Severity: Major
            Found in public_html/layouts/basic/modules/Vtiger/resources/dashboards/Widget.js - About 40 mins to fix

              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']))
                              ) {
              Severity: Major
              Found in public_html/layouts/resources/app.js - About 40 mins to fix

                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');
                Severity: Major
                Found in public_html/layouts/resources/validator/FieldValidator.js - About 40 mins to fix

                  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);
                  Severity: Major
                  Found in app/Validator.php - About 40 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language