YetiForceCompany/YetiForceCRM

View on GitHub

Showing 306,333 of 306,333 total issues

Function isReadWritePermittedBySharing has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring.
Open

    public static function isReadWritePermittedBySharing($moduleName, $tabId, $actionId, $recordId, $userId)
    {
        \App\Log::trace("Entering isReadWritePermittedBySharing($moduleName,$tabId,$actionId,$recordId,$userId) method ...");
        $sharingPrivileges = \App\User::getSharingFile($userId);
        if (!isset($sharingPrivileges['permission'][$moduleName])) {
Severity: Minor
Found in app/Privilege.php - About 1 day 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 Owner.php has 616 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Owner class.
 *
 * @package App
Severity: Major
Found in app/Fields/Owner.php - About 1 day to fix

    Function initInventoryValuesByUser has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
    Open

        private function initInventoryValuesByUser()
        {
            $invData = [];
            $counter = 1;
            foreach ($this->cleanRecordModels as $groupBy => $newRecordModel) {
    Severity: Minor
    Found in app/RecordConverter.php - About 1 day 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 68 (exceeds 5 allowed). Consider refactoring.
    Open

        public function process()
        {
            $html = '';
            $inventoryRows = [];
            if (!$this->textParser->recordModel->getModule()->isInventory()) {
    Severity: Minor
    Found in app/TextParser/ProductsTable.php - About 1 day 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 DashBoard.js has 609 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*+**********************************************************************************
     * The contents of this file are subject to the vtiger CRM Public License Version 1.1
     * ("License"); You may not use this file except in compliance with the License
     * The Original Code is:  vtiger CRM Open Source
     * The Initial Developer of the Original Code is vtiger.
    Severity: Major
    Found in public_html/layouts/basic/modules/Vtiger/resources/DashBoard.js - About 1 day to fix

      Function category has 265 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          $.jstree.plugins.category = function (options, parent) {
              this.bind = function () {
                  parent.bind.call(this);
                  this._data.category.selected = [];
                  this.element.on(
      Severity: Major
      Found in public_html/layouts/resources/libraries/jstree.category.js - About 1 day to fix

        Method getDetailViewLinks has 265 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getDetailViewLinks(array $linkParams): array
            {
                if ($this->has('Links')) {
                    return $this->get('Links');
                }
        Severity: Major
        Found in modules/Vtiger/models/DetailView.php - About 1 day to fix

          Function getBreadcrumbs has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function getBreadcrumbs($pageTitle = false)
              {
                  $breadcrumbs = [];
                  $request = App\Request::init();
                  $userPrivModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
          Severity: Minor
          Found in modules/Vtiger/models/Menu.php - About 1 day 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

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

              public function process(): int
              {
                  $query = (new \App\Db\Query())->from('dbo.KONTAKT');
                  $pauser = \App\Pauser::getInstance('WaproContactsLastId');
                  if ($val = $pauser->getValue()) {
          Severity: Major
          Found in app/Integrations/Wapro/Synchronizer/Contacts.php and 1 other location - About 1 day to fix
          app/Integrations/Wapro/Synchronizer/Accounts.php on lines 52..95

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

          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 function process(): int
              {
                  $query = (new \App\Db\Query())->from('dbo.KONTRAHENT');
                  $pauser = \App\Pauser::getInstance('WaproAccountLastId');
                  if ($val = $pauser->getValue()) {
          Severity: Major
          Found in app/Integrations/Wapro/Synchronizer/Accounts.php and 1 other location - About 1 day to fix
          app/Integrations/Wapro/Synchronizer/Contacts.php on lines 40..83

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

          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 function blackList(App\Request $request)
              {
                  $rows = [];
                  $query = $this->getQuery($request);
                  $query->from('s_#__mail_rbl_list')->andWhere(['type' => \App\Mail\Rbl::LIST_TYPE_BLACK_LIST]);
          Severity: Major
          Found in modules/Settings/MailRbl/actions/GetData.php and 1 other location - About 1 day to fix
          modules/Settings/MailRbl/actions/GetData.php on lines 225..251

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

          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

              private function parseRow(array $row): array
              {
                  return [
                      'addresslevel1' => [$row['address']['country'] ?? '', strtoupper($row['address']['country_code'] ?? '')],
                      'addresslevel2' => $row['address']['state'] ?? '',
          Severity: Major
          Found in app/Map/Address/YetiForceGeocoder.php and 1 other location - About 1 day to fix
          app/Map/Address/NominatimGeocoder.php on lines 119..134

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

          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 function whiteList(App\Request $request)
              {
                  $rows = [];
                  $query = $this->getQuery($request);
                  $query->from('s_#__mail_rbl_list')->andWhere(['type' => \App\Mail\Rbl::LIST_TYPE_WHITE_LIST]);
          Severity: Major
          Found in modules/Settings/MailRbl/actions/GetData.php and 1 other location - About 1 day to fix
          modules/Settings/MailRbl/actions/GetData.php on lines 192..218

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

          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

              private function parseRow(array $row): array
              {
                  return [
                      'addresslevel1' => [$row['address']['country'] ?? '', strtoupper($row['address']['country_code'] ?? '')],
                      'addresslevel2' => $row['address']['state'] ?? '',
          Severity: Major
          Found in app/Map/Address/NominatimGeocoder.php and 1 other location - About 1 day to fix
          app/Map/Address/YetiForceGeocoder.php on lines 129..144

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

          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 WebservicePremiumTest.php has 602 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          /**
           * Webservice Premium Test integrations test file.
           *
           * @see https://github.com/Maks3w/SwaggerAssertions/
          Severity: Major
          Found in tests/Integrations/WebservicePremiumTest.php - About 1 day to fix

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

            Vtiger_Base_Validator_Js(
                'Calendar_greaterThanToday_Validator_Js',
                {},
                {
                    /**
            Severity: Major
            Found in public_html/layouts/resources/validator/FieldValidator.js and 1 other location - About 1 day to fix
            public_html/layouts/resources/validator/FieldValidator.js on lines 626..659

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

            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

            Vtiger_Base_Validator_Js(
                'Vtiger_lessThanToday_Validator_Js',
                {},
                {
                    /**
            Severity: Major
            Found in public_html/layouts/resources/validator/FieldValidator.js and 1 other location - About 1 day to fix
            public_html/layouts/resources/validator/FieldValidator.js on lines 1311..1344

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

            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

            Method checkPermission has 259 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function checkPermission($moduleName, $actionName = null, $record = false, $userId = false)
                {
                    \App\Log::trace("Entering isPermitted($moduleName,$actionName,$record,$userId) method ...");
                    if (!$userId) {
                        $userId = \App\User::getCurrentUserId();
            Severity: Major
            Found in app/Privilege.php - About 1 day to fix

              Function process has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function process(): string
                  {
                      $html = '';
                      $moduleName = $this->params[0];
                      if (!empty($textParserParams = $this->textParser->getParam('textParserParams')) && isset($textParserParams['userId'])
              Severity: Minor
              Found in app/TextParser/UserRecordsDuplicateList.php - About 1 day 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

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

                      $.extend($.fn.dataTable.defaults, {
                          language: {
                              sLengthMenu: app.vtranslate('JS_S_LENGTH_MENU'),
                              sZeroRecords: app.vtranslate('JS_NO_RESULTS_FOUND'),
                              sInfo: app.vtranslate('JS_S_INFO'),
              Severity: Major
              Found in public_html/layouts/resources/app.js and 2 other locations - About 1 day to fix
              public_html/layouts/basic/modules/Settings/Logs/resources/Index.js on lines 85..107
              public_html/layouts/basic/modules/Vtiger/resources/TreeRecords.js on lines 63..85

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

              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