YetiForceCompany/YetiForceCRM

View on GitHub

Showing 306,333 of 306,333 total issues

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

                        if ('Name' === $typeName) {
                            $fieldValue = '<strong>' . $fieldModel->getDisplayValue($itemValue, $inventoryRow) . '</strong>';
                            foreach ($inventory->getFieldsByType('Comment') as $commentField) {
                                if ($commentField->isVisible() && ($value = $inventoryRow[$commentField->getColumnName()]) && $comment = $commentField->getDisplayValue($value, $inventoryRow)) {
                                    $fieldValue .= '<br />' . $comment;
Severity: Major
Found in app/TextParser/ProductsTableLongVTwoLang.php and 1 other location - About 5 hrs to fix
app/TextParser/ProductsTableLongVersion.php on lines 80..92

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

                        if ('Name' === $typeName) {
                            $fieldValue = '<strong>' . $fieldModel->getDisplayValue($itemValue, $inventoryRow) . '</strong>';
                            foreach ($inventory->getFieldsByType('Comment') as $commentField) {
                                if ($commentField->isVisible() && ($value = $inventoryRow[$commentField->getColumnName()]) && $comment = $commentField->getDisplayValue($value, $inventoryRow)) {
                                    $fieldValue .= '<br />' . $comment;
Severity: Major
Found in app/TextParser/ProductsTableLongVersion.php and 1 other location - About 5 hrs to fix
app/TextParser/ProductsTableLongVTwoLang.php on lines 79..91

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

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('user2role', $modTabId, $currentUserRoles) as $row) {
                $shareUserId = (int) $row['share_userid'];
                $shareIdUsers = [];
                $shareIdUsers[] = $shareUserId;
                if (1 === (int) $row['permission']) {
Severity: Major
Found in app/PrivilegeUtil.php and 3 other locations - About 5 hrs to fix
app/PrivilegeUtil.php on lines 1165..1182
app/PrivilegeUtil.php on lines 1184..1201
app/PrivilegeUtil.php on lines 1223..1240

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

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

<?php

/**
 * Api CardDAV Model Class.
 *
Severity: Minor
Found in modules/API/models/CardDAV.php - About 5 hrs to fix

    Method getFieldItemByName has 144 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getFieldItemByName($name)
        {
            if (isset($this->items[$name])) {
                return $this->items[$name];
            }
    Severity: Major
    Found in modules/Settings/LayoutEditor/models/Field.php - About 5 hrs to fix

      Method operationsAfterPicklistRename has 144 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function operationsAfterPicklistRename($entityData)
          {
              $dbCommand = App\Db::getInstance()->createCommand();
              $pickListFieldName = $entityData['fieldname'];
              $oldValue = $entityData['oldvalue'];
      Severity: Major
      Found in modules/Settings/Picklist/handlers/PickListHandler.php - About 5 hrs to fix

        Function recordSaveAttendee has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
        Open

            public function recordSaveAttendee(\Vtiger_Record_Model $record)
            {
                if ('VEVENT' === (string) $this->vcomponent->name) {
                    $invities = $this->getInvitations($record->getId());
                    $time = VObject\DateTimeParser::parse($this->vcomponent->DTSTAMP);
        Severity: Minor
        Found in app/Integrations/Dav/Calendar.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 saveLocks has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
        Open

            public function saveLocks($data)
            {
                $oldValues = $this->getLocks();
                $map = $toSave = [];
                if (!empty($data)) {
        Severity: Minor
        Found in modules/Settings/Users/models/Module.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 getRates has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getRates($otherCurrencyCode, $dateParam, $cron = false)
            {
                $moduleModel = Settings_CurrencyUpdate_Module_Model::getCleanInstance();
                $selectedBank = $moduleModel->getActiveBankId();
                $yesterday = date('Y-m-d', strtotime('-1 day'));
        Severity: Minor
        Found in modules/Settings/CurrencyUpdate/bankmodels/CBR.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 getNextTriggerTimeForWeekly has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getNextTriggerTimeForWeekly($scheduledDaysOfWeek, $scheduledTime)
            {
                $weekDays = ['1' => 'Monday', '2' => 'Tuesday', '3' => 'Wednesday', '4' => 'Thursday', '5' => 'Friday', '6' => 'Saturday', '7' => 'Sunday'];
                $currentTime = time();
                $currentWeekDay = date('N', $currentTime);
        Severity: Minor
        Found in modules/com_vtiger_workflow/Workflow.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 getListViewHeaders has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getListViewHeaders()
            {
                $headerFieldModels = [];
                if ($this->isEmpty('viewId')) {
                    $queryGenerator = $this->getQueryGenerator();
        Severity: Minor
        Found in modules/Vtiger/models/ListView.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

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

                addNewCondition: function (conditionGroupElement) {
                    var basicElement = jQuery('.basic', conditionGroupElement);
                    var newRowElement = basicElement.find('.js-conditions-row').clone(true, true);
                    jQuery('select', newRowElement).addClass('select2');
                    var conditionList = jQuery('.conditionList', conditionGroupElement);
        public_html/layouts/basic/modules/Vtiger/resources/AdvanceFilterEx.js on lines 49..64

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

        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

                addNewCondition: function (conditionGroupElement) {
                    var basicElement = jQuery('.basic', conditionGroupElement);
                    var newRowElement = basicElement.find('.js-conditions-row').clone(true, true);
                    jQuery('select', newRowElement).addClass('select2');
                    var conditionList = jQuery('.conditionList', conditionGroupElement);
        public_html/layouts/basic/modules/Settings/Workflows/resources/AdvanceFilter.js on lines 51..65

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

        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

                registerApproveFilterClickEvent: function () {
                    const thisInstance = this;
                    const listViewFilterBlock = this.getFilterBlock();
                    if (listViewFilterBlock != false) {
                        listViewFilterBlock.on('mouseup', '.js-filter-approve', (event) => {
        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/List.js on lines 1487..1499

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

        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

                registerDenyFilterClickEvent: function () {
                    const thisInstance = this;
                    const listViewFilterBlock = this.getFilterBlock();
                    if (listViewFilterBlock != false) {
                        listViewFilterBlock.on('mouseup', '.js-filter-deny', (event) => {
        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/List.js on lines 1471..1483

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

        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

            public function setRouting(App\Request $request): void
            {
                $result = false;
                try {
                    $osm = new \App\ConfigFile('module', 'OpenStreetMap');
        Severity: Major
        Found in modules/Settings/Map/actions/Config.php and 1 other location - About 5 hrs to fix
        modules/Settings/Map/actions/Config.php on lines 81..101

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

        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

            public function setCoordinate(App\Request $request): void
            {
                $result = false;
                try {
                    $osm = new \App\ConfigFile('module', 'OpenStreetMap');
        Severity: Major
        Found in modules/Settings/Map/actions/Config.php and 1 other location - About 5 hrs to fix
        modules/Settings/Map/actions/Config.php on lines 108..128

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

        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 ProgressIndicatorHelper has 142 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            var ProgressIndicatorHelper = function () {
                var thisInstance = this;
        
                this.defaults = {
                    position: 'append',
        Severity: Major
        Found in public_html/layouts/resources/ProgressIndicator.js - About 5 hrs to fix

          Method showRelatedList has 142 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function showRelatedList(App\Request $request)
              {
                  $moduleName = $request->getModule();
                  $relatedModuleName = $request->getByType('relatedModule', 2);
                  $parentId = $request->getInteger('record');
          Severity: Major
          Found in modules/PriceBooks/views/Detail.php - About 5 hrs to fix

            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 33..45

            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

            Severity
            Category
            Status
            Source
            Language