YetiForceCompany/YetiForceCRM

View on GitHub

Showing 306,333 of 306,333 total issues

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

                    if (type === 'RelatedModule' || type === 'RelatedModuleChart' || type === 'Documents') {
                        thisInstance.loadFilters(wizardContainer);
                        thisInstance.relatedModuleFields(wizardContainer);
                        thisInstance.customView(wizardContainer);
                        wizardContainer.find("select[name='relation_id']").on('change', function () {
public_html/layouts/basic/modules/Settings/Widgets/resources/Widgets.js on lines 230..239

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

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 ($field->isReferenceField()) {
                            $relModule = \App\Record::getType($recordModel->get($field->getName()));
                            if ($relModule && 'Users' !== $relModule && \App\Privilege::isPermitted($relModule, 'DetailView', $recordModel->get($field->getName()), $userId)) {
                                $relatedRecordModel = \Vtiger_Record_Model::getInstanceById($recordModel->get($field->getName()));
                                $entriesPart[] = ' [<a href="' . \App\Config::main('site_URL') . $relatedRecordModel->getDetailViewUrl() . '">' . $value . '</a>] ';
Severity: Major
Found in app/TextParser/UserRecordsList.php and 1 other location - About 4 hrs to fix
app/TextParser/UserRecordsDuplicateList.php on lines 74..84

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

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 ($field->isReferenceField()) {
                                $relModule = \App\Record::getType($recordModel->get($field->getName()));
                                if ($relModule && 'Users' !== $relModule && \App\Privilege::isPermitted($relModule, 'DetailView', $recordModel->get($field->getName()), $userId)) {
                                    $relatedRecordModel = \Vtiger_Record_Model::getInstanceById($recordModel->get($field->getName()));
                                    $entriesPart[] = ' [<a href="' . \App\Config::main('site_URL') . $relatedRecordModel->getDetailViewUrl() . '">' . $value . '</a>] ';
Severity: Major
Found in app/TextParser/UserRecordsDuplicateList.php and 1 other location - About 4 hrs to fix
app/TextParser/UserRecordsList.php on lines 95..105

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

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

Function _request has 103 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _request: function (params, pjaxMode, rawData) {
        const aDeferred = jQuery.Deferred();
        if (typeof rawData === 'undefined') {
            rawData = false;
        }
Severity: Major
Found in public_html/layouts/resources/Connector.js - About 4 hrs to fix

    Method checkZip has 103 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function checkZip($zipfile)
        {
            $manifestFound = $languagefile_found = $layoutfile_found = $updatefile_found = $extensionfile_found = $moduleVersionFound = $fontfile_found = false;
            $moduleName = null;
            $zip = \App\Zip::openFile($zipfile, ['checkFiles' => false]);
    Severity: Major
    Found in vtlib/Vtiger/PackageImport.php - About 4 hrs to fix

      Method getDetailViewRelatedLinks has 103 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getDetailViewRelatedLinks()
          {
              $recordModel = $this->getRecord();
              $moduleName = $recordModel->getModuleName();
              $parentModuleModel = $this->getModule();
      Severity: Major
      Found in modules/Accounts/models/DetailView.php - About 4 hrs to fix

        Method getListViewMassActions has 103 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getListViewMassActions($linkParams)
            {
                $currentUser = Users_Record_Model::getCurrentUserModel();
                $moduleModel = $this->getModule();
                $links = Vtiger_Link_Model::getAllByType($moduleModel->getId(), ['LISTVIEWMASSACTION'], $linkParams);
        Severity: Major
        Found in modules/Vtiger/models/ListView.php - About 4 hrs to fix

          Method isPermitted has 103 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function isPermitted(string $moduleName, $actionName = null, $record = false, $userId = false)
              {
                  if (!$userId) {
                      $user = \App\User::getCurrentUserModel();
                  } else {
          Severity: Major
          Found in api/webservice/WebservicePremium/Privilege.php - About 4 hrs to fix

            File Workflow.php has 338 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
             * The Original Code is:  vtiger CRM Open Source
            Severity: Minor
            Found in modules/com_vtiger_workflow/Workflow.php - About 4 hrs to fix

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

                      validateFileSize(file) {
                          let result = typeof file.size === 'number' && file.size < this.options.maxFileSize;
                          if (!result) {
                              file.error = {
                                  title: `${app.vtranslate('JS_UPLOADED_FILE_SIZE_EXCEEDS')} <br> [${this.options.maxFileSizeDisplay}]`,
              Severity: Major
              Found in public_html/layouts/resources/Fields.js and 1 other location - About 4 hrs to fix
              public_html/layouts/resources/app.js on lines 1060..1069

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

              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

                      validateFileSize(file) {
                          let result = typeof file.size === 'number' && file.size < this.options.maxFileSize;
                          if (!result) {
                              file.error = {
                                  title: `${app.vtranslate('JS_UPLOADED_FILE_SIZE_EXCEEDS')} <br> [${this.options.maxFileSizeDisplay}]`,
              Severity: Major
              Found in public_html/layouts/resources/app.js and 1 other location - About 4 hrs to fix
              public_html/layouts/resources/Fields.js on lines 3517..3526

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

              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 Iframe.js has 337 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /* {[The file is published on the basis of YetiForce Public License 6.5 that can be found in the following directory: licenses/LicenseEN.txt or yetiforce.com]} */
              'use strict';
              
              window.MailIntegration_Iframe = {
                  mailId: 0,
              Severity: Minor
              Found in public_html/layouts/basic/modules/MailIntegration/resources/Iframe.js - About 4 hrs to fix

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

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

                  Function mapResultsToFields has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                  Open

                          mapResultsToFields: function (referenceModule, parentRow, responseData) {
                              let unit,
                                  taxParam = [];
                              let thisInstance = this;
                              let isGroupTax = thisInstance.isGroupTaxMode();
                  Severity: Minor
                  Found in public_html/layouts/basic/modules/Vtiger/resources/Inventory.js - 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 sanitizeInventoryValues has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function sanitizeInventoryValues(array $inventoryRow, array $inventoryFields): array
                      {
                          $inventoryEntries = [];
                          foreach ($inventoryFields as $columnName => $field) {
                              $value = $inventoryRow[$columnName];
                  Severity: Minor
                  Found in app/Export/Records.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 parseAdvFilter has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function parseAdvFilter($advFilterList = false)
                      {
                          if (!$advFilterList) {
                              $advFilterList = $this->advFilterList;
                          }
                  Severity: Minor
                  Found in app/QueryGenerator.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 import has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function import(): bool
                      {
                          $allChecked = false;
                          try {
                              if ($orders = $this->getOrdersFromApi()) {
                  Severity: Minor
                  Found in app/Integrations/Magento/Synchronizer/Order.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 getDenormalizedData has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function getDenormalizedData($calendarData)
                      {
                          $vObject = VObject\Reader::read($calendarData);
                          $uid = $lastOccurence = $firstOccurence = $component = $componentType = null;
                          foreach ($vObject->getComponents() as $component) {
                  Severity: Minor
                  Found in app/Integrations/Dav/Calendar.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 getUsersByGroup has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function getUsersByGroup($groupId, $subGroups = false, $i = 0)
                      {
                          $cacheKey = $groupId . (false === $subGroups ? '' : '#');
                          if (Cache::has('getUsersByGroup', $cacheKey)) {
                              return Cache::get('getUsersByGroup', $cacheKey);
                  Severity: Minor
                  Found in app/PrivilegeUtil.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 getMenu has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function getMenu(string $moduleName, string $view, string $mode = '', &$selected = null): array
                      {
                          $selectedFieldId = 0;
                          $selectedBlockId = 0;
                          $menu = [];
                  Severity: Minor
                  Found in modules/Settings/Vtiger/models/Menu.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

                  Severity
                  Category
                  Status
                  Source
                  Language