YetiForceCompany/YetiForceCRM

View on GitHub

Showing 306,333 of 306,333 total issues

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

            foreach (static::getDatashare('rs2rs', $modTabId, $parRoleList) as $row) {
                $shareRoleIds = static::getRoleSubordinates($row['share_roleandsubid']);
                $shareRoleIds[] = $row['share_roleandsubid'];
                foreach ($shareRoleIds as $shareRoleId) {
                    if (1 === (int) $row['permission']) {
Severity: Major
Found in app/PrivilegeUtil.php and 3 other locations - About 6 hrs to fix
app/PrivilegeUtil.php on lines 898..916
app/PrivilegeUtil.php on lines 938..956
app/PrivilegeUtil.php on lines 958..976

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

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

            foreach (static::getDatashare('rs2role', $modTabId, $currentUserRoles) as $row) {
                $shareRoleIds = static::getRoleSubordinates($row['share_roleandsubid']);
                $shareRoleIds[] = $row['share_roleandsubid'];
                foreach ($shareRoleIds as $shareRoleId) {
                    if (1 === (int) $row['permission']) {
Severity: Major
Found in app/PrivilegeUtil.php and 3 other locations - About 6 hrs to fix
app/PrivilegeUtil.php on lines 918..936
app/PrivilegeUtil.php on lines 938..956
app/PrivilegeUtil.php on lines 958..976

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

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

            foreach (static::getDatashare('rs2group', $modTabId, $groupList) as $row) {
                $shareRoleIds = static::getRoleSubordinates($row['share_roleandsubid']);
                $shareRoleIds[] = $row['share_roleandsubid'];
                foreach ($shareRoleIds as $shareRoleId) {
                    if (1 === (int) $row['permission']) {
Severity: Major
Found in app/PrivilegeUtil.php and 3 other locations - About 6 hrs to fix
app/PrivilegeUtil.php on lines 898..916
app/PrivilegeUtil.php on lines 918..936
app/PrivilegeUtil.php on lines 958..976

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

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

<?php

/**
 * RecordConverter class.
 *
Severity: Minor
Found in app/RecordConverter.php - About 6 hrs to fix

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

        public function validate($value, string $columnName, bool $isUserFormat, $originalValue = null)
        {
            if ($isUserFormat) {
                $value = $this->getDBValue($value, $columnName);
                if (null !== $originalValue) {
    Severity: Major
    Found in modules/Vtiger/inventoryfields/TotalPrice.php and 3 other locations - About 6 hrs to fix
    modules/Vtiger/inventoryfields/GrossPrice.php on lines 46..63
    modules/Vtiger/inventoryfields/Margin.php on lines 46..63
    modules/Vtiger/inventoryfields/NetPrice.php on lines 46..63

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

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

        public function validate($value, string $columnName, bool $isUserFormat, $originalValue = null)
        {
            if ($isUserFormat) {
                $value = $this->getDBValue($value, $columnName);
                if (null !== $originalValue) {
    Severity: Major
    Found in modules/Vtiger/inventoryfields/NetPrice.php and 3 other locations - About 6 hrs to fix
    modules/Vtiger/inventoryfields/GrossPrice.php on lines 46..63
    modules/Vtiger/inventoryfields/Margin.php on lines 46..63
    modules/Vtiger/inventoryfields/TotalPrice.php on lines 46..63

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

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

        public function validate($value, string $columnName, bool $isUserFormat, $originalValue = null)
        {
            if ($isUserFormat) {
                $value = $this->getDBValue($value, $columnName);
                if (null !== $originalValue) {
    Severity: Major
    Found in modules/Vtiger/inventoryfields/GrossPrice.php and 3 other locations - About 6 hrs to fix
    modules/Vtiger/inventoryfields/Margin.php on lines 46..63
    modules/Vtiger/inventoryfields/NetPrice.php on lines 46..63
    modules/Vtiger/inventoryfields/TotalPrice.php on lines 46..63

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

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

        public function validate($value, string $columnName, bool $isUserFormat, $originalValue = null)
        {
            if ($isUserFormat) {
                $value = $this->getDBValue($value, $columnName);
                if (null !== $originalValue) {
    Severity: Major
    Found in modules/Vtiger/inventoryfields/Margin.php and 3 other locations - About 6 hrs to fix
    modules/Vtiger/inventoryfields/GrossPrice.php on lines 46..63
    modules/Vtiger/inventoryfields/NetPrice.php on lines 46..63
    modules/Vtiger/inventoryfields/TotalPrice.php on lines 46..63

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

    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

                    next.on('click', function () {
                        if ($(this).hasClass('disabled')) {
                            return;
                        }
                        let active = container.find('.js-carousel-item.active');
    Severity: Major
    Found in public_html/layouts/basic/modules/Vtiger/resources/Detail.js and 1 other location - About 6 hrs to fix
    public_html/layouts/basic/modules/Vtiger/resources/Detail.js on lines 454..469

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

    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

                    prev.on('click', function () {
                        if ($(this).hasClass('disabled')) {
                            return;
                        }
                        let active = container.find('.js-carousel-item.active');
    Severity: Major
    Found in public_html/layouts/basic/modules/Vtiger/resources/Detail.js and 1 other location - About 6 hrs to fix
    public_html/layouts/basic/modules/Vtiger/resources/Detail.js on lines 438..453

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

    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 Gantt.js has 435 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 Gantt {
        /**
    Severity: Minor
    Found in public_html/layouts/basic/modules/Project/resources/Gantt.js - About 6 hrs to fix

      File ConfigTemplates.php has 435 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * Components config.
       *
       * @copyright YetiForce S.A.
      Severity: Minor
      Found in config/Components/ConfigTemplates.php - About 6 hrs to fix

        Function recalculatePasswords has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function recalculatePasswords(string $method, string $password, string $vector)
            {
                $dbAdmin = \App\Db::getInstance('admin');
                $decryptInstance = static::getInstance();
                if ($decryptInstance->get('method') === $method && $decryptInstance->get('vector') === $vector && $decryptInstance->get('pass') === $password) {
        Severity: Minor
        Found in app/Encryptions/Settings.php - About 6 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 addData has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
        Open

            public function addData(Base $importer)
            {
                if (!isset($importer->data)) {
                    return;
                }
        Severity: Minor
        Found in app/Db/Importer.php - About 6 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 convertToNativeLink has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
        Open

            public function convertToNativeLink()
            {
                $url = $this->get('linkurl');
                if (empty($url)) {
                    return $url;
        Severity: Minor
        Found in modules/Vtiger/models/Link.php - About 6 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 42 (exceeds 5 allowed). Consider refactoring.
        Open

            public function process()
            {
                \App\Log::trace('Start create AddressBook');
        
                $limit = App\Config::performance('CRON_MAX_NUMBERS_RECORD_ADDRESS_BOOK_UPDATER');
        Severity: Minor
        Found in modules/Vtiger/crons/AddressBook.php - About 6 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

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

                    this.elements.fileInput.fileupload({
                        dataType: 'json',
                        replaceFileInput: false,
                        fileInput: this.fileInput,
                        autoUpload: false,
        Severity: Major
        Found in public_html/layouts/resources/fields/MultiImage.js and 1 other location - About 6 hrs to fix
        public_html/layouts/resources/Fields.js on lines 3389..3402

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

        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

                    this.fileInput.fileupload({
                        dataType: 'json',
                        replaceFileInput: false,
                        fileInput: this.fileInput,
                        autoUpload: false,
        Severity: Major
        Found in public_html/layouts/resources/Fields.js and 1 other location - About 6 hrs to fix
        public_html/layouts/resources/fields/MultiImage.js on lines 42..55

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

        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 ListSearch.js has 432 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(
            'YetiForce_ListSearch_Js',
        Severity: Minor
        Found in public_html/layouts/basic/modules/Vtiger/resources/ListSearch.js - About 6 hrs to fix

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

                                          if (response[i].type === 'confirm' && typeof response[i].hash !== 'undefined') {
                                              app.showConfirmModal({
                                                  text: response[i].message || '',
                                                  confirmedCallback: () => {
                                                      let handlers = {};
          Severity: Major
          Found in public_html/layouts/basic/modules/Vtiger/resources/Edit.js and 1 other location - About 6 hrs to fix
          public_html/layouts/basic/modules/Vtiger/resources/Edit.js on lines 987..1020

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

          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