YetiForceCompany/YetiForceCRM

View on GitHub

Showing 306,333 of 306,333 total issues

Function updateRecords has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    public function updateRecords()
    {
        if ($this->isEmpty('id')) {
            return [];
        }
Severity: Minor
Found in app/Fields/RecordNumber.php - About 4 hrs 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 transferOwnershipForWorkflow has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    private static function transferOwnershipForWorkflow($oldId, $newId)
    {
        $db = \App\Db::getInstance();
        $ownerName = static::getLabel($oldId);
        $newOwnerName = static::getLabel($newId);
Severity: Minor
Found in app/Fields/Owner.php - About 4 hrs 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 getFileFromImage has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    private function getFileFromImage(DOMElement $element, array $params, array &$attachments): array
    {
        $src = trim($element->getAttribute('src'), '\'');
        $element->removeAttribute('src');
        $file = [];
Severity: Minor
Found in modules/OSSMail/models/Mail.php - About 4 hrs 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 isLockByFields has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    public function isLockByFields()
    {
        if (!isset($this->privileges['isLockByFields'])) {
            $isLock = false;
            $moduleName = $this->getModuleName();
Severity: Minor
Found in modules/Vtiger/models/Record.php - About 4 hrs 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 initializeContent has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    public function initializeContent(App\Request $request)
    {
        $viewer = $this->getViewer($request);
        $this->moduleName = $request->getModule();
        $this->sourceModule = $request->getByType('src_module', 2);
Severity: Minor
Found in modules/Vtiger/views/RecordsList.php - About 4 hrs 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 setRelatedFieldsInHierarchy has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    public function setRelatedFieldsInHierarchy(Vtiger_Record_Model $recordModel, $fieldName)
    {
        $fieldValue = $recordModel->get($fieldName);
        $relatedModules = \App\ModuleHierarchy::getRelationFieldByHierarchy($recordModel->getModuleName(), $fieldName);
        if ($relatedModules && !empty($fieldValue) && $recordModel->getPreviousValue($fieldName) !== $fieldValue) {
Severity: Minor
Found in modules/Vtiger/actions/SaveAjax.php - About 4 hrs 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 read has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    public function read()
    {
        $defaultCharset = App\Config::main('default_charset');
        $this->createTable();

Severity: Minor
Found in modules/Import/readers/XmlReader.php - About 4 hrs 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 createQuery has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    public function createQuery(): void
    {
        $this->queryGenerator = new \App\QueryGenerator('Users');
        $limit = 1000;
        if ($requestLimit = $this->controller->request->getHeader('x-row-limit')) {
Severity: Minor
Found in api/webservice/WebserviceStandard/Users/RecordsList.php - About 4 hrs 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

File Field.php has 357 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace App;

/**
Severity: Minor
Found in app/Field.php - About 4 hrs to fix

    Method process has 114 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function process()
        {
            $html = '';
            if (!$this->textParser->recordModel->getModule()->isInventory()) {
                return $html;
    Severity: Major
    Found in app/TextParser/ProductsTableImages.php - About 4 hrs to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      <?php
      /**
       * RecordPopover model class for OSSTimeControl.
       *
       * @package   Model
      Severity: Major
      Found in modules/OSSTimeControl/models/RecordPopover.php and 1 other location - About 4 hrs to fix
      modules/Calendar/models/RecordPopover.php on lines 1..41

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 174.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      <?php
      /**
       * RecordPopover model class for Calendar.
       *
       * @package   Model
      Severity: Major
      Found in modules/Calendar/models/RecordPopover.php and 1 other location - About 4 hrs to fix
      modules/OSSTimeControl/models/RecordPopover.php on lines 1..38

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 174.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      File RelationAjax.php has 355 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
       /* +***********************************************************************************
       * 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
      Severity: Minor
      Found in modules/Vtiger/actions/RelationAjax.php - About 4 hrs to fix

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

            public function testGetRecordHistory(): void
            {
                $request = $this->httpClient->get('HelpDesk/RecordHistory/' . self::$recordId, self::$requestOptions);
                $this->logs = $body = $request->getBody()->getContents();
                $response = \App\Json::decode($body);
        Severity: Major
        Found in tests/Integrations/WebservicePremiumTest.php and 2 other locations - About 4 hrs to fix
        tests/Integrations/WebservicePremiumTest.php on lines 457..465
        tests/Integrations/WebservicePremiumTest.php on lines 470..478

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 173.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. 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: Major
        Found in modules/SRecurringOrders/SRecurringOrders.php and 2 other locations - About 4 hrs to fix
        modules/SRequirementsCards/SRequirementsCards.php on lines 72..86
        modules/SSalesProcesses/SSalesProcesses.php on lines 74..88

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 173.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

            public function moduleHandler($moduleName, $eventType)
            {
                if ('module.postinstall' === $eventType) {
                    \App\Fields\RecordNumber::getInstance($moduleName)->set('prefix', 'S-RC')->set('cur_id', 1)->save();
                    \App\Db::getInstance()->createCommand()->update('vtiger_tab', ['customized' => 0], ['name' => $moduleName])->execute();
        Severity: Major
        Found in modules/SRequirementsCards/SRequirementsCards.php and 2 other locations - About 4 hrs to fix
        modules/SRecurringOrders/SRecurringOrders.php on lines 85..99
        modules/SSalesProcesses/SSalesProcesses.php on lines 74..88

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 173.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

            public function testGetPdf(): void
            {
                $request = $this->httpClient->get('FInvoiceProforma/Pdf/' . self::$inventoryRecordId, self::$requestOptions);
                $this->logs = $body = $request->getBody()->getContents();
                $response = \App\Json::decode($body);
        Severity: Major
        Found in tests/Integrations/WebservicePremiumTest.php and 2 other locations - About 4 hrs to fix
        tests/Integrations/WebservicePremiumTest.php on lines 324..332
        tests/Integrations/WebservicePremiumTest.php on lines 457..465

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 173.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

            public function testGetPdfTemplates(): void
            {
                $request = $this->httpClient->get('FInvoiceProforma/PdfTemplates/' . self::$inventoryRecordId, self::$requestOptions);
                $this->logs = $body = $request->getBody()->getContents();
                $response = \App\Json::decode($body);
        Severity: Major
        Found in tests/Integrations/WebservicePremiumTest.php and 2 other locations - About 4 hrs to fix
        tests/Integrations/WebservicePremiumTest.php on lines 324..332
        tests/Integrations/WebservicePremiumTest.php on lines 470..478

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 173.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

            public function moduleHandler($moduleName, $eventType)
            {
                if ('module.postinstall' === $eventType) {
                    \App\Fields\RecordNumber::getInstance($moduleName)->set('prefix', 'S-SP')->set('cur_id', 1)->save();
                    \App\Db::getInstance()->createCommand()->update('vtiger_tab', ['customized' => 0], ['name' => $moduleName])->execute();
        Severity: Major
        Found in modules/SSalesProcesses/SSalesProcesses.php and 2 other locations - About 4 hrs to fix
        modules/SRecurringOrders/SRecurringOrders.php on lines 85..99
        modules/SRequirementsCards/SRequirementsCards.php on lines 72..86

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 173.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            public static function getPageFormats(): array
            {
                return [
                    '4A0',
                    '2A0',
        Severity: Major
        Found in app/Pdf/Pdf.php and 1 other location - About 4 hrs to fix
        modules/Settings/PDF/models/Module.php on lines 94..115

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 173.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Severity
        Category
        Status
        Source
        Language