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 ($relatedModuleName === $parentModuleName) {
            $queryGenerator->addJoin([
                'INNER JOIN',
                $referenceInfo['table'], "({$referenceInfo['table']}.{$referenceInfo['base']} = vtiger_crmentity.crmid OR {$referenceInfo['table']}.{$referenceInfo['rel']} = vtiger_crmentity.crmid)",
            ])->addNativeCondition([
Severity: Major
Found in modules/Vtiger/relations/GetManyToMany.php and 1 other location - About 5 hrs to fix
modules/Vtiger/relations/GetManyToMany.php on lines 98..110

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

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

Vtiger_Base_UIType has 42 functions (exceeds 20 allowed). Consider refactoring.
Open

class Vtiger_Base_UIType extends \App\Base
{
    /** @var bool Search allowed */
    protected $search = true;

Severity: Minor
Found in modules/Vtiger/uitypes/Base.php - About 5 hrs to fix

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

                                if (field === 'value' && valueSelectElement.is('input')) {
                                    let pickListValues = valueSelectElement.data('picklistvalues'),
                                        valuesArr = valueSelectElement.val().split(','),
                                        newValuesArr = [];
                                    for (i = 0; i < valuesArr.length; i++) {
    public_html/layouts/basic/modules/Vtiger/resources/AdvanceFilter.js on lines 561..598
    public_html/layouts/basic/modules/Vtiger/resources/AdvanceFilterEx.js on lines 146..173

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

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

                                } else if (field === 'value' && valueSelectElement.is('input')) {
                                    let pickListValues = valueSelectElement.data('picklistvalues'),
                                        valuesArr = valueSelectElement.val().split(','),
                                        newValuesArr = [];
                                    for (i = 0; i < valuesArr.length; i++) {
    public_html/layouts/basic/modules/Settings/Workflows/resources/AdvanceFilter.js on lines 157..184
    public_html/layouts/basic/modules/Vtiger/resources/AdvanceFilterEx.js on lines 146..173

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

    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 ($('#listViewEntriesMainCheckBox').is(':checked')) {
                        let recordCountObj = thisInstance.getRecordsCount();
                        recordCountObj.done(function (data) {
                            $('#totalRecordsCount').text(data);
                            if ($('#deSelectAllMsgDiv').css('display') == 'none') {
    Severity: Major
    Found in public_html/layouts/basic/modules/Vtiger/resources/List.js and 1 other location - About 5 hrs to fix
    public_html/layouts/basic/modules/Vtiger/resources/RelatedList.js on lines 1462..1495

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

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

                                if (field === 'value' && valueSelectElement.is('input')) {
                                    let pickListValues = valueSelectElement.data('picklistvalues'),
                                        valuesArr = valueSelectElement.val().split(','),
                                        newValuesArr = [];
                                    for (i = 0; i < valuesArr.length; i++) {
    public_html/layouts/basic/modules/Settings/Workflows/resources/AdvanceFilter.js on lines 157..184
    public_html/layouts/basic/modules/Vtiger/resources/AdvanceFilter.js on lines 561..598

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

    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 ($('#relatedListViewEntriesMainCheckBox').is(':checked')) {
                        let progress = $.progressIndicator({ blockInfo: { enabled: true } });
                        let recordCountObj = self.getRecordsCount();
                        recordCountObj
                            .done(function (data) {
    public_html/layouts/basic/modules/Vtiger/resources/List.js on lines 1269..1299

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

    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

                this.sideBlockLeft.on('click', () => {
                    let gutterRelatedMidPosition = app.moduleCacheGet('gutterRelatedMidPosition');
                    if (gutterRelatedMidPosition[0] > 11) {
                        split.setSizes(gutterRelatedMidPosition);
                    } else {
    public_html/layouts/basic/modules/Vtiger/resources/ListPreview.js on lines 208..219

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

    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

                this.sideBlockLeft.on('click', () => {
                    let gutterMidPosition = app.moduleCacheGet('gutterMidPosition');
                    if (gutterMidPosition[0] > 11) {
                        split.setSizes(gutterMidPosition);
                    } else {
    public_html/layouts/basic/modules/Vtiger/resources/RelatedList.js on lines 1204..1215

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

    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 Record.php has 402 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/Settings/Groups/models/Record.php - About 5 hrs to fix

      File Index.js has 401 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';
      
      jQuery.Class(
          'Settings_MailRbl_Index_Js',
      Severity: Minor
      Found in public_html/layouts/basic/modules/Settings/MailRbl/resources/Index.js - About 5 hrs to fix

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

                foreach (static::getAllGroupColor() as $item) {
                    if (null !== $item['color'] && ltrim($item['color'], '#')) {
                        $css .= '.ownerCBg_' . $item['id'] . ' { background: ' . $item['color'] . ' !important; font-weight: 500 !important; color: ' . static::getContrast($item['color']) . ' !important;}' . PHP_EOL;
                        $css .= '.ownerCT_' . $item['id'] . ' { color: ' . $item['color'] . ' !important; }' . PHP_EOL;
                        $css .= '.ownerCBr_' . $item['id'] . ' { border-color: ' . $item['color'] . ' !important; }' . PHP_EOL;
        Severity: Major
        Found in app/Colors.php and 1 other location - About 5 hrs to fix
        app/Colors.php on lines 61..68

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

        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

                foreach (static::getAllUserColor() as $item) {
                    if (null !== $item['color'] && ltrim($item['color'], '#')) {
                        $css .= '.ownerCBg_' . $item['id'] . ' { background: ' . $item['color'] . ' !important; font-weight: 500 !important; color: ' . static::getContrast($item['color']) . ' !important;}' . PHP_EOL;
                        $css .= '.ownerCT_' . $item['id'] . ' { color: ' . $item['color'] . ' !important; }' . PHP_EOL;
                        $css .= '.ownerCBr_' . $item['id'] . ' { border-color: ' . $item['color'] . ' !important; }' . PHP_EOL;
        Severity: Major
        Found in app/Colors.php and 1 other location - About 5 hrs to fix
        app/Colors.php on lines 69..76

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

        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 PackageUpdate.php has 400 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 vtlib/Vtiger/PackageUpdate.php - About 5 hrs to fix

          Function findByDomainField has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function findByDomainField(string $moduleName, array $fields, array $emails): array
              {
                  $return = $activeFields = $domainsAndEmails = [];
                  foreach ($emails as $email) {
                      $domainsAndEmails[mb_strtolower(explode('@', $email)[1])][] = $email;
          Severity: Minor
          Found in app/Mail/RecordFinder.php - About 5 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 recalculateSharingRulesByUser has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function recalculateSharingRulesByUser($id)
              {
                  $userModel = \App\User::getUserModel($id);
                  if (!$userModel->getId()) {
                      return null;
          Severity: Minor
          Found in app/PrivilegeUtil.php - About 5 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 imapConnect has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function imapConnect($user, $password, $host = '', $folder = 'INBOX', $dieOnError = true, $config = [], array $account = [])
              {
                  \App\Log::trace("Entering OSSMail_Record_Model::imapConnect($user , '****' , $folder) method ...");
                  if (!$config) {
                      $config = self::loadRoundcubeConfig();
          Severity: Minor
          Found in modules/OSSMail/models/Record.php - About 5 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 setRelatedParent has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
          Open

              public function setRelatedParent(App\Request $request)
              {
                  $filterFields = $request->getArray('filterFields', 'Text');
                  if (!($relationId = $request->isEmpty('relationId') ? 0 : $request->getInteger('relationId')) && $this->sourceField) {
                      $relationId = \App\Relation::getRelationId($this->moduleName, $this->sourceModule, $this->sourceField);
          Severity: Minor
          Found in modules/Vtiger/views/RecordsList.php - About 5 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 37 (exceeds 5 allowed). Consider refactoring.
          Open

              public function process()
              {
                  $db = \App\Db::getInstance();
                  $executed = [];
                  $limit = 1000;
          Severity: Minor
          Found in modules/Vtiger/crons/MultiReference.php - About 5 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

          File Request.php has 399 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          /**
           * Request basic class.
           *
           * @package App
          Severity: Minor
          Found in app/Request.php - About 5 hrs to fix
            Severity
            Category
            Status
            Source
            Language