YetiForceCompany/YetiForceCRM

View on GitHub

Showing 306,333 of 306,333 total issues

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

<?php
/**
 * CInternalTickets CRMEntity Class.
 *
 * @copyright YetiForce S.A.
Severity: Major
Found in modules/CMileageLogbook/CMileageLogbook.php and 2 other locations - About 4 hrs to fix
modules/CFixedAssets/CFixedAssets.php on lines 1..59
modules/CInternalTickets/CInternalTickets.php on lines 1..59

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

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 ($listColumns as $colname) {
            // Permission to view sales is restricted, avoid showing field values (except sales name)
            if (\App\Field::getFieldPermission('MultiCompany', $colname)) {
                $data = \App\Purifier::encodeHtml($baseInfo[$colname]);
                if (false === $getRawData && 'subject' === $colname) {
Severity: Major
Found in modules/MultiCompany/MultiCompany.php and 3 other locations - About 4 hrs to fix
modules/HelpDesk/models/Module.php on lines 111..131
modules/IStorages/IStorages.php on lines 131..153
modules/Project/Project.php on lines 187..207

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

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

    public function importLayout($zipfile)
    {
        $name = $this->_modulexml->name;
        $label = $this->_modulexml->label;
        \App\Log::trace("Importing $name ... STARTED", __METHOD__);
Severity: Minor
Found in vtlib/Vtiger/LayoutImport.php - About 4 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function parseParams has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    public function parseParams(array $params)
    {
        foreach ($params as $param => $value) {
            switch ($param) {
                case 'margin-top':
Severity: Minor
Found in app/Pdf/Drivers/Base.php - About 4 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function parsePhone has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    private function parsePhone(): void
    {
        $country = null;
        if ($userId = $this->user ? $this->user->getId() : null) {
            $country = \App\Fields\Country::getCountryCode(\App\User::getUserModel($userId)->getDetail('sync_carddav_default_country'));
Severity: Minor
Found in app/Integrations/Dav/Card.php - About 4 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function validate has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    public function validate(array $data, bool $throw = true)
    {
        $message = null;
        $code = null;
        $result = false;
Severity: Minor
Found in modules/Settings/LayoutEditor/models/Module.php - About 4 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function process has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    public function process()
    {
        $dbCommand = App\Db::getInstance()->createCommand();
        $scannerModel = Vtiger_Record_Model::getCleanInstance('OSSMailScanner');
        $dataReader = (new App\Db\Query())->select([
Severity: Minor
Found in modules/OSSMailScanner/crons/Bind.php - About 4 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function normalizeData has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    protected function normalizeData()
    {
        foreach ($this->data as &$dividing) {
            foreach ($dividing as $groupValueKey => &$values) {
                // iterate data one more time to search other group values
Severity: Minor
Found in modules/Vtiger/models/ChartFilter.php - About 4 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function showRelatedRecords has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    public function showRelatedRecords(App\Request $request)
    {
        $parentId = $request->getInteger('record');
        $pageNumber = $request->getInteger('page');
        $relationId = $request->isEmpty('relationId') ? false : $request->getInteger('relationId');
Severity: Minor
Found in modules/Vtiger/views/Detail.php - About 4 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function showSearchResults has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    public function showSearchResults(App\Request $request)
    {
        $viewer = $this->getViewer($request);
        $moduleName = $request->getModule();
        $advFilterList = $request->getArray('advfilterlist', 'Text');
Severity: Minor
Found in modules/Vtiger/views/BasicAjax.php - About 4 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function createTree has 118 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        createTree: function () {
            const self = this;
            if (!this.jstreeInstance) {
                self.jstreeLastID = parseInt($('#treeLastID').val());
                let treeValues = $('#treeValues').val(),

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

        public static function addWidgetTo($moduleNames, $widgetType = 'DETAILVIEWWIDGET', $widgetName = 'DetailViewBlockCommentWidget')
        {
            if (empty($moduleNames)) {
                return;
            }
    Severity: Major
    Found in modules/ModComments/ModComments.php and 1 other location - About 4 hrs to fix
    modules/ModComments/ModComments.php on lines 105..129

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

    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 static function removeWidgetFrom($moduleNames, $widgetType = 'DETAILVIEWWIDGET', $widgetName = 'DetailViewBlockCommentWidget')
        {
            if (empty($moduleNames)) {
                return;
            }
    Severity: Major
    Found in modules/ModComments/ModComments.php and 1 other location - About 4 hrs to fix
    modules/ModComments/ModComments.php on lines 72..96

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

    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 ($this->getModule()->getFieldsByType(['image', 'multiImage'], true) as $fieldName => $fieldModel) {
                $currentData = [];
                if ($this->get($fieldName) && ($this->isNew() || false !== $this->getPreviousValue($fieldName))) {
                    $currentData = \App\Fields\File::parse(\App\Json::decode($this->get($fieldName)));
                    \App\Fields\File::cleanTemp(array_keys($currentData));
    Severity: Major
    Found in modules/Users/models/Record.php and 1 other location - About 4 hrs to fix
    modules/Vtiger/handlers/Files.php on lines 25..40

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

    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 ($recordModel->getModule()->getFieldsByType(['image', 'multiImage', 'multiAttachment'], true) as $fieldName => $fieldModel) {
                $currentData = [];
                if ($recordModel->get($fieldName) && ($recordModel->isNew() || false !== $recordModel->getPreviousValue($fieldName))) {
                    $currentData = \App\Fields\File::parse(\App\Json::decode($recordModel->get($fieldName)));
                    \App\Fields\File::cleanTemp(array_keys($currentData));
    Severity: Major
    Found in modules/Vtiger/handlers/Files.php and 1 other location - About 4 hrs to fix
    modules/Users/models/Record.php on lines 381..396

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

    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

            registerHierarchyRecordCount: function () {
                var hierarchyButton = $('.detailViewTitle .hierarchy');
                if (hierarchyButton.length) {
                    var params = {
                        module: app.getModuleName(),
    public_html/layouts/basic/modules/Accounts/resources/Detail.js on lines 57..72
    public_html/layouts/basic/modules/IStorages/resources/Detail.js on lines 47..62
    public_html/layouts/basic/modules/MultiCompany/resources/Detail.js on lines 47..62

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

    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

            registerHierarchyRecordCount: function () {
                var hierarchyButton = $('.detailViewTitle .hierarchy');
                if (hierarchyButton.length) {
                    var params = {
                        module: app.getModuleName(),
    public_html/layouts/basic/modules/IStorages/resources/Detail.js on lines 47..62
    public_html/layouts/basic/modules/MultiCompany/resources/Detail.js on lines 47..62
    public_html/layouts/basic/modules/SSalesProcesses/resources/Detail.js on lines 51..66

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

    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

            registerHierarchyRecordCount: function () {
                let hierarchyButton = $('.js-detail-hierarchy'),
                    params = {
                        module: app.getModuleName(),
                        action: 'RelationAjax',
    public_html/layouts/basic/modules/Competition/resources/Detail.js on lines 42..57
    public_html/layouts/basic/modules/HelpDesk/resources/Detail.js on lines 87..102
    public_html/layouts/basic/modules/Project/resources/Detail.js on lines 96..111

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

    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

            registerHierarchyRecordCount: function () {
                let hierarchyButton = $('.js-detail-hierarchy'),
                    params = {
                        module: app.getModuleName(),
                        action: 'RelationAjax',
    public_html/layouts/basic/modules/Competition/resources/Detail.js on lines 42..57
    public_html/layouts/basic/modules/Contacts/resources/Detail.js on lines 95..110
    public_html/layouts/basic/modules/HelpDesk/resources/Detail.js on lines 87..102

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

    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

            registerHierarchyRecordCount: function () {
                var hierarchyButton = $('.detailViewTitle .hierarchy');
                if (hierarchyButton.length) {
                    var params = {
                        module: app.getModuleName(),
    public_html/layouts/basic/modules/Accounts/resources/Detail.js on lines 57..72
    public_html/layouts/basic/modules/MultiCompany/resources/Detail.js on lines 47..62
    public_html/layouts/basic/modules/SSalesProcesses/resources/Detail.js on lines 51..66

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

    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