YetiForceCompany/YetiForceCRM

View on GitHub

Showing 4,652 of 306,333 total issues

Function moduleHandler has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function moduleHandler($moduleName, $eventType)
    {
        if ('module.postinstall' === $eventType) {
            \App\Fields\RecordNumber::getInstance($moduleName)->set('prefix', 'S-RO')->set('cur_id', 1)->save();
            \App\Db::getInstance()->createCommand()->update('vtiger_tab', ['customized' => 0], ['name' => $moduleName])->execute();
Severity: Minor
Found in modules/SRecurringOrders/SRecurringOrders.php - About 35 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 getGanttMilestones has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getGanttMilestones($projectIds)
    {
        $queryGenerator = new App\QueryGenerator('ProjectMilestone');
        $queryGenerator->setFields(['id', 'parentid', 'projectid', 'projectmilestonename', 'projectmilestonedate', 'projectmilestone_no', 'projectmilestone_progress', 'projectmilestone_priority', 'sum_time', 'estimated_work_time', 'projectmilestone_status', 'assigned_user_id']);
        $queryGenerator->addNativeCondition(['vtiger_projectmilestone.projectid' => $projectIds]);
Severity: Minor
Found in modules/Project/models/Gantt.php - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function get(): array
    {
        $parentId = \App\Record::getParentRecord($this->getUserCrmId());
        if (\in_array($this->getPermissionType(), [\Api\WebservicePremium\Privilege::ACCOUNTS_RELATED_RECORDS_IN_HIERARCHY, \Api\WebservicePremium\Privilege::ACCOUNTS_RELATED_RECORDS_AND_LOWER_IN_HIERARCHY])) {
            $fields = \App\Field::getRelatedFieldForModule($this->moduleName);
Severity: Minor
Found in api/webservice/WebservicePremium/BaseModule/Hierarchy.php - About 35 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 getRecordFromRow has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getRecordFromRow(array $row): array
    {
        $record = ['recordLabel' => \App\Fields\Owner::getUserLabel($row['id'])];
        if ($this->isAdmin && $this->fields) {
            $moduleModel = reset($this->fields)->getModule();
Severity: Minor
Found in api/webservice/WebserviceStandard/Users/RecordsList.php - About 35 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 getActionClassName has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function getActionClassName(): string
    {
        $type = $this->request->getByType('_container', 'Standard');
        $this->request->delete('_container');
        $actionName = $this->request->getByType('action', 'Alnum');
Severity: Minor
Found in api/webservice/Controller.php - About 35 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 getRecordWithChildren has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function &getRecordWithChildren(&$task)
    {
        foreach ($this->tasks as &$child) {
            if (isset($child['parent']) && $child['parent'] === $task['id']) {
                if (empty($task['children'])) {
Severity: Minor
Found in modules/Project/models/Gantt.php - About 35 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 validate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function validate(): bool
    {
        $inventoryErrors = [];
        foreach ($this->inventory as $inventoryKey => $inventoryItem) {
            if ('Products' === $this->products[$inventoryKey]['module']) {
Severity: Minor
Found in api/webservice/WebservicePremium/Inventory.php - About 35 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 getUnitPrice has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function getUnitPrice(array $response): float
    {
        if (null === $this->unitPrice) {
            if ($this->isUserPermissions) {
                $unitPrice = (new \Vtiger_MultiCurrency_UIType())->getValueForCurrency($response['rawData']['unit_price'] ?? [], \App\Fields\Currency::getDefault()['id']);
Severity: Minor
Found in api/webservice/WebservicePremium/Products/Record.php - About 35 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 7 (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/BaseModule/Record.php - About 35 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 getDefaultValue has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static function getDefaultValue(\Vtiger_Field_Model $fieldModel, array $fieldData, \Api\Core\BaseAction $actionModel)
    {
        $value = $fieldData['default_value'];
        $list = \App\Field::getCustomListForDefaultValue($fieldModel);
        if (isset($list[$value])) {
Severity: Minor
Found in api/webservice/WebserviceStandard/Fields.php - About 35 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

Avoid too many return statements within this function.
Open

                if ($.contains($(e.currentTarget).find('td:last-child').get(0), e.target)) return;
Severity: Major
Found in public_html/layouts/basic/modules/Settings/PDF/resources/List.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                    if ($.contains($(e.currentTarget).find('td:first-child').get(0), e.target)) return;
    Severity: Major
    Found in public_html/layouts/basic/modules/Settings/PDF/resources/List.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                      return this.addValidationToElement(element);

        Avoid too many return statements within this function.
        Open

                            if ($.contains($(e.currentTarget).find('td:first-child').get(0), target[0])) return;
        Severity: Major
        Found in public_html/layouts/basic/modules/Vtiger/resources/RelatedList.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                          if ($.contains($(e.currentTarget).find('td:last-child').get(0), e.target)) return;
          Severity: Major
          Found in public_html/layouts/basic/modules/Vtiger/resources/ListPreview.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                                if ($.contains($(e.currentTarget).find('td:last-child').get(0), target[0])) return;
            Severity: Major
            Found in public_html/layouts/basic/modules/Vtiger/resources/RelatedList.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                              if ($(e.target).is('input[type="checkbox"]')) return;
              Severity: Major
              Found in public_html/layouts/basic/modules/Vtiger/resources/ListPreview.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                if ($.contains($(e.currentTarget).find('td:first-child').get(0), e.target)) return;
                Severity: Major
                Found in public_html/layouts/basic/modules/Vtiger/resources/ListPreview.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                      return;
                  Severity: Major
                  Found in public_html/layouts/basic/modules/Vtiger/resources/ListPreview.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                        if ($(e.target, $(e.currentTarget)).is('td:first-child')) return;
                    Severity: Major
                    Found in public_html/layouts/basic/modules/Vtiger/resources/RelatedList.js - About 30 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language