YetiForceCompany/YetiForceCRM

View on GitHub

Showing 306,333 of 306,333 total issues

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

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

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

OSSMailScanner_Record_Model has 35 functions (exceeds 20 allowed). Consider refactoring.
Open

class OSSMailScanner_Record_Model extends Vtiger_Record_Model
{
    /**
     * Main folders array.
     *
Severity: Minor
Found in modules/OSSMailScanner/models/Record.php - About 4 hrs to fix

    Vtiger_Inventory_Model has 35 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Vtiger_Inventory_Model
    {
        /**
         * Field configuration table postfix.
         */
    Severity: Minor
    Found in modules/Vtiger/models/Inventory.php - About 4 hrs to fix

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

              readSelectedIds: function (decode) {
                  let selectedIdsDataAttr = this.getCurrentCvId() + 'selectedIds',
                      selectedIdsElementDataAttributes = $('#selectedIds').data(),
                      selectedIds = [];
                  if (!(selectedIdsDataAttr in selectedIdsElementDataAttributes)) {
      public_html/layouts/basic/modules/Vtiger/resources/RelatedList.js on lines 1401..1414

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

      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

                  if (
                      listFilterFields[sourceField] != undefined &&
                      listFilterFields[sourceField][popupReferenceModule] != undefined
                  ) {
                      $.each(listFilterFields[sourceField][popupReferenceModule], function (index, value) {
      Severity: Major
      Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 1 other location - About 4 hrs to fix
      public_html/layouts/basic/modules/Vtiger/resources/Edit.js on lines 240..250

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

      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

              readExcludedIds: function (decode) {
                  let excludedIdsDataAttr = this.getCurrentCvId() + 'Excludedids',
                      excludedIdsElementDataAttributes = $('#excludedIds').data(),
                      excludedIds = [];
                  if (!(excludedIdsDataAttr in excludedIdsElementDataAttributes)) {
      public_html/layouts/basic/modules/Vtiger/resources/RelatedList.js on lines 1381..1394

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

      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

                  if (
                      mappingRelatedModule[sourceField] != undefined &&
                      mappingRelatedModule[sourceField][popupReferenceModule] != undefined
                  ) {
                      $.each(mappingRelatedModule[sourceField][popupReferenceModule], function (index, value) {
      Severity: Major
      Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 1 other location - About 4 hrs to fix
      public_html/layouts/basic/modules/Vtiger/resources/Edit.js on lines 253..263

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

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

      /*+*******************************************************************************
       * 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
       * The Initial Developer of the Original Code is vtiger.

        File ListPreview.js has 351 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';
        
        Vtiger_List_Js(
            'Vtiger_ListPreview_Js',
        Severity: Minor
        Found in public_html/layouts/basic/modules/Vtiger/resources/ListPreview.js - About 4 hrs to fix

          File Field.js has 351 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /*+***********************************************************************************
           * 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
           * The Initial Developer of the Original Code is vtiger.
          Severity: Minor
          Found in public_html/layouts/resources/Field.js - About 4 hrs to fix

            File ChatAjax.php has 351 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            /**
             * Action to get Chat data.
             *
            Severity: Minor
            Found in modules/Chat/actions/ChatAjax.php - About 4 hrs to fix

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

                      sanitizeFieldMapping: function () {
                          var fieldsList = jQuery('.fieldIdentifier');
                          var mappedFields = {};
                          var inventoryMappedFields = {};
                          var errorMessage;
              Severity: Minor
              Found in public_html/layouts/basic/modules/Import/resources/Import.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 getViewId has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getViewId($noCache = false)
                  {
                      \App\Log::trace(__METHOD__);
                      if (isset($this->defaultViewId)) {
                          return $this->defaultViewId;
              Severity: Minor
              Found in app/CustomView.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 getVendorLibraries has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function getVendorLibraries()
                  {
                      $libraries = [];
                      if (file_exists(ROOT_DIRECTORY . '/composer.lock')) {
                          $composerLock = \App\Json::decode(file_get_contents(ROOT_DIRECTORY . '/composer.lock'), true);
              Severity: Minor
              Found in app/Installer/Credits.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 process has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function process()
                  {
                      if (!$this->textParser->recordModel || !$this->textParser->recordModel->getModule()->isInventory()) {
                          return '';
                      }
              Severity: Minor
              Found in app/TextParser/TableTaxSummary.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 getSupportedCurrencies has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getSupportedCurrencies()
                  {
                      $supportedCurrencies = [];
                      $supportedCurrencies[Settings_CurrencyUpdate_Module_Model::getCRMCurrencyName($this->getMainCurrencyCode())] = $this->getMainCurrencyCode();
                      $dateCur = date('Y-m-d', strtotime('last monday'));
              Severity: Minor
              Found in modules/Settings/CurrencyUpdate/bankmodels/NBP.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 doTask has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function doTask($rawRecordModel)
                  {
                      $recordModel = \Vtiger_Record_Model::getCleanInstance($rawRecordModel->getModuleName());
                      $recordModel->setData($rawRecordModel->getData());
                      $recordModel->ext = $rawRecordModel->ext;
              Severity: Minor
              Found in modules/com_vtiger_workflow/tasks/VTUpdateFieldsTask.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 getAccountFieldsForLeadConvert has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getAccountFieldsForLeadConvert()
                  {
                      $accountsFields = [];
                      $moduleName = 'Accounts';
              
              
              Severity: Minor
              Found in modules/Leads/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 getInventoryChanges has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getInventoryChanges()
                  {
                      if (!isset($this->inventoryChanges)) {
                          $changes = [];
                          if ($this->isCreate() || $this->isUpdate() || $this->isTransferEdit()) {
              Severity: Minor
              Found in modules/ModTracker/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 getRecordListViewLinksLeftSide has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getRecordListViewLinksLeftSide()
                  {
                      if (!$this->isViewable()) {
                          return [];
                      }
              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

              Severity
              Category
              Status
              Source
              Language