YetiForceCompany/YetiForceCRM

View on GitHub

Showing 306,333 of 306,333 total issues

Function preProcess has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    public function preProcess(App\Request $request, $display = true)
    {
        parent::preProcess($request, false);

        $moduleName = $request->getModule();
Severity: Minor
Found in modules/Vtiger/views/Detail.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 getHierarchyData has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    public function getHierarchyData($id, $baseInfo, $recordId, &$listviewEntries, $getRawData = false, $getLinks = true)
    {
        \App\Log::trace('Entering getHierarchyData(' . $id . ',' . $recordId . ') method ...');
        $currentUser = Users_Privileges_Model::getCurrentUserModel();
        $hasRecordViewAccess = $currentUser->isAdminUser() || \App\Privilege::isPermitted('Contacts', 'DetailView', $recordId);
Severity: Minor
Found in modules/Contacts/Contacts.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 get has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    public function get(): array
    {
        $this->loadResponseParams();
        $moduleName = $this->controller->request->get('module');
        $module = \Vtiger_Module_Model::getInstance($moduleName);
Severity: Minor
Found in api/webservice/WebserviceStandard/BaseModule/Fields.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

Method formatCurrencyValue has 110 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function formatCurrencyValue($value)
    {
        $currencyPattern = $this->currencyFormat;
        $curSeparator = $this->currencySeparator;
        $decSeparator = $this->decimalSeparator;
Severity: Major
Found in include/fields/CurrencyField.php - About 4 hrs to fix

    Function registerRelatedListEvents has 109 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            registerRelatedListEvents: function () {
                const thisInstance = this,
                    relatedList = $('#relatedTabOrder');
                App.Fields.Picklist.showSelect2ElementView(
                    relatedList.find('.relatedTabModulesList .js-related-column-list-container .select2_container'),

      Function render has 109 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              render: function () {
                  this.bindAttr('data', function (data) {
                      // ported from php DataFormatter
                      var formatDuration = function (seconds) {
                          if (seconds < 0.001) return (seconds * 1000000).toFixed() + 'μs';
      Severity: Major
      Found in public_html/layouts/resources/debugbar/logs.js - About 4 hrs to fix

        Method getInventoryTable has 109 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getInventoryTable(array $config): string
            {
                $rawText = empty($config['href']) || 'yes' !== $config['href'];
                $inventory = \Vtiger_Inventory_Model::getInstance($this->moduleName);
                $fields = $inventory->getFieldsByBlocks();
        Severity: Major
        Found in app/TextParser.php - About 4 hrs to fix

          Method getBreadcrumbs has 109 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function getBreadcrumbs($pageTitle = false)
              {
                  $breadcrumbs = [];
                  $request = App\Request::init();
                  $userPrivModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
          Severity: Major
          Found in modules/Vtiger/models/Menu.php - About 4 hrs to fix

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

                                if (match != null) {
                                    if (conditionValue != 'has changed') {
                                        options += '<option value="' + conditionValue + '"';
                                        if (conditionValue == conditionSelected) {
                                            options += ' selected="selected" ';
            public_html/layouts/basic/modules/Vtiger/resources/AdvanceFilterEx.js on lines 92..106

            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 122.

            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

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

                                if (match != null) {
                                    if (conditionValue != 'has changed') {
                                        options += '<option value="' + conditionValue + '"';
                                        if (conditionValue == conditionSelected) {
                                            options += ' selected="selected" ';
            public_html/layouts/basic/modules/Settings/Workflows/resources/AdvanceFilter.js on lines 104..118

            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 122.

            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

                        for (i = 0, j = this._data.checkbox.selected.length; i < j; i++) {
                            if (this._model.data[this._data.checkbox.selected[i]]) {
                                this._model.data[this._data.checkbox.selected[i]].state.checked = true;
                            }
                        }
            Severity: Major
            Found in public_html/layouts/resources/libraries/jstree.checkbox.js and 1 other location - About 4 hrs to fix
            public_html/layouts/resources/libraries/jstree.checkbox.js on lines 847..851

            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 122.

            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

                        for (i = 0, j = this._data.checkbox.selected.length; i < j; i++) {
                            if (this._model.data[this._data.checkbox.selected[i]]) {
                                this._model.data[this._data.checkbox.selected[i]].state.checked = false;
                            }
                        }
            Severity: Major
            Found in public_html/layouts/resources/libraries/jstree.checkbox.js and 1 other location - About 4 hrs to fix
            public_html/layouts/resources/libraries/jstree.checkbox.js on lines 819..823

            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 122.

            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

            `` has 34 functions (exceeds 20 allowed). Consider refactoring.
            Open

            export default {
                maximize({ commit }, isMini) {
                    commit('miniMode', isMini)
                },
                toggleLeftPanel({ commit, getters }, newValue) {
            Severity: Minor
            Found in public_html/src/layouts/basic/modules/Chat/store/actions.js - About 4 hrs to fix

              WebservicePremiumTest has 34 functions (exceeds 20 allowed). Consider refactoring.
              Open

              final class WebservicePremiumTest extends \Tests\Base
              {
                  use AssertsTrait;
              
                  /** @var int Api server id. */
              Severity: Minor
              Found in tests/Integrations/WebservicePremiumTest.php - About 4 hrs to fix

                Consider simplifying this complex logical expression.
                Open

                        if (empty(self::$browserCache)) {
                            $browserAgent = strtolower(\App\Request::_getServer('HTTP_USER_AGENT', ''));
                
                            $browser = new \stdClass();
                            $browser->ver = 0;
                Severity: Critical
                Found in app/RequestUtil.php - About 4 hrs to fix

                  File Record.php has 347 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  
                  /**
                   * Settings menu record model class.
                   *
                  Severity: Minor
                  Found in modules/Settings/Menu/models/Record.php - About 4 hrs to fix

                    Function setMarkers has 108 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            setMarkers: function (data) {
                                var thisInstance = this;
                                var markerArray = [];
                                var container = this.container;
                                var map = this.mapInstance;
                    Severity: Major
                    Found in public_html/layouts/basic/modules/OpenStreetMap/resources/Map.js - About 4 hrs to fix

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

                      <?php
                      
                      /**
                       * Inventory Value Field Class.
                       *
                      Severity: Major
                      Found in modules/Vtiger/inventoryfields/Value.php and 1 other location - About 4 hrs to fix
                      modules/Vtiger/inventoryfields/Unit.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 169.

                      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
                      
                      /**
                       * Inventory Unit Field Class.
                       *
                      Severity: Major
                      Found in modules/Vtiger/inventoryfields/Unit.php and 1 other location - About 4 hrs to fix
                      modules/Vtiger/inventoryfields/Value.php on lines 1..36

                      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 169.

                      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 6 locations. Consider refactoring.
                      Open

                      Vtiger_Edit_Js(
                          'SQuoteEnquiries_Edit_Js',
                          {},
                          {
                              getRecordsListParams: function (container) {
                      public_html/layouts/basic/modules/SCalculations/resources/Edit.js on lines 4..18
                      public_html/layouts/basic/modules/SRecurringOrders/resources/Edit.js on lines 4..18
                      public_html/layouts/basic/modules/SRequirementsCards/resources/Edit.js on lines 4..18
                      public_html/layouts/basic/modules/SSingleOrders/resources/Edit.js on lines 4..18
                      public_html/layouts/basic/modules/SVendorEnquiries/resources/Edit.js on lines 4..18

                      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 121.

                      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