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 function getChild($id, &$childRow, $depthBase)
    {
        \App\Log::trace('Entering getChild(' . $id . ',' . $depthBase . ') method ...');
        if (empty($id) || $depthBase == App\Config::module('MultiCompany', 'MAX_HIERARCHY_DEPTH')) {
            \App\Log::error('Exiting getChild method ... - exceeded maximum depth of hierarchy');
Severity: Major
Found in modules/MultiCompany/MultiCompany.php and 1 other location - About 2 days to fix
modules/Competition/Competition.php on lines 334..379

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

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 saveModulePermissions has a Cognitive Complexity of 97 (exceeds 5 allowed). Consider refactoring.
Open

    protected function saveModulePermissions($moduleModel, $permissions)
    {
        $db = \App\Db::getInstance();
        $dbCommand = $db->createCommand();
        $profileId = $this->getId();
Severity: Minor
Found in modules/Settings/Profiles/models/Record.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

Method checkCondition has 377 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function checkCondition(Vtiger_Record_Model $recordModel, $cond, Vtiger_Record_Model $referredRecordModel = null)
    {
        $condition = $cond['operation'];
        $fieldInstance = $recordModel->getModule()->getFieldByName($cond['fieldname']);
        if (empty($condition) || false === $fieldInstance) {
Severity: Major
Found in modules/com_vtiger_workflow/VTJsonCondition.php - About 1 day to fix

    File Relation.php has 795 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: Major
    Found in modules/Vtiger/models/Relation.php - About 1 day to fix

      File Edit3.js has 787 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 Record.php has 786 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
         /* +***********************************************************************************
         * The contents of this file are subject to the vtiger CRM Public License Version 1.0
         * ("License"); You may not use this file except in compliance with the License
        Severity: Major
        Found in modules/Users/models/Record.php - About 1 day to fix

          Function bind has 371 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  this.bind = function () {
                      parent.bind.call(this);
                      this._data.checkbox.uto = false;
                      this._data.checkbox.selected = [];
                      this.element
          Severity: Major
          Found in public_html/layouts/resources/libraries/jstree.checkbox.js - About 1 day to fix

            Vtiger_Field_Model has 97 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Vtiger_Field_Model extends vtlib\Field
            {
                const REFERENCE_TYPE = 'reference';
                const OWNER_TYPE = 'owner';
                const CURRENCY_LIST = 'currencyList';
            Severity: Major
            Found in modules/Vtiger/models/Field.php - About 1 day to fix

              File ChartFilter.php has 773 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              /**
               * Model widget chart with a filter.
               *
               * @package Model
              Severity: Major
              Found in modules/Vtiger/models/ChartFilter.php - About 1 day to fix

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

                    {
                        targetPicklistChange: false,
                        targetPicklist: false,
                        detailViewContentHolder: false,
                        detailViewForm: false,
                Severity: Major
                Found in public_html/layouts/basic/modules/Vtiger/resources/Detail.js - About 1 day to fix

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

                          while ($record = $dataReader->read()) {
                              $item = [];
                              $item['id'] = $record['id'];
                              $item['title'] = \App\Purifier::encodeHtml($record['title']);
                  
                  
                  Severity: Major
                  Found in modules/Reservations/models/Calendar.php and 1 other location - About 1 day to fix
                  modules/OSSTimeControl/models/Calendar.php on lines 118..140

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

                  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

                          while ($record = $dataReader->read()) {
                              $item = [];
                              $item['id'] = $record['id'];
                              $item['title'] = \App\Purifier::encodeHtml($record['name']);
                  
                  
                  Severity: Major
                  Found in modules/OSSTimeControl/models/Calendar.php and 1 other location - About 1 day to fix
                  modules/Reservations/models/Calendar.php on lines 117..139

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

                  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 Calendar.js has 745 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';
                  
                  /** Class representing a calendar. */
                  window.Calendar_Js = class {
                  Severity: Major
                  Found in public_html/layouts/resources/Calendar.js - About 1 day to fix

                    File Calendar.php has 741 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    /**
                     * CalDav calendar file.
                     *
                     * @package Integration
                    Severity: Major
                    Found in app/Integrations/Dav/Calendar.php - About 1 day to fix

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

                                  container.on('click', '.endTrack', function (e) {
                                      if (endIconLayer) {
                                          map.removeLayer(endIconLayer);
                                      }
                                      var currentTarget = $(e.currentTarget);
                      public_html/layouts/basic/modules/OpenStreetMap/resources/Map.js on lines 558..581

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

                      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

                                  container.on('click', '.startTrack', function (e) {
                                      if (startIconLayer) {
                                          map.removeLayer(startIconLayer);
                                      }
                                      var currentTarget = $(e.currentTarget);
                      public_html/layouts/basic/modules/OpenStreetMap/resources/Map.js on lines 583..606

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

                      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 ($dataReader->count()) {
                                  $this->openNode('relatedlists');
                                  while ($row = $dataReader->read()) {
                                      $this->openNode('relatedlist');
                                      $this->outputNode(Module::getInstance($row['related_tabid'])->name, 'relatedmodule');
                      Severity: Major
                      Found in vtlib/Vtiger/PackageExport.php and 1 other location - About 1 day to fix
                      vtlib/Vtiger/PackageExport.php on lines 691..725

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

                      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 ($dataReaderRow->count()) {
                                  $this->openNode('inrelatedlists');
                                  while ($row = $dataReaderRow->read()) {
                                      $this->openNode('inrelatedlist');
                                      $this->outputNode(Module::getInstance($row['tabid'])->name, 'inrelatedmodule');
                      Severity: Major
                      Found in vtlib/Vtiger/PackageExport.php and 1 other location - About 1 day to fix
                      vtlib/Vtiger/PackageExport.php on lines 653..687

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

                      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 getInventoryTable has a Cognitive Complexity of 84 (exceeds 5 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: Minor
                      Found in app/TextParser.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 2 locations. Consider refactoring.
                      Open

                              registerChangeFieldEvent: function (data) {
                                  jQuery('.textType', data).on('change', function (e) {
                                      var valueType = jQuery(e.currentTarget).val();
                                      var useFieldContainer = jQuery('.useFieldContainer', data);
                                      var useFunctionContainer = jQuery('.useFunctionContainer', data);
                      public_html/layouts/basic/modules/Vtiger/resources/AdvanceFilterEx.js on lines 341..363

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

                      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