YetiForceCompany/YetiForceCRM

View on GitHub

Showing 306,333 of 306,333 total issues

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

        displayHierarchyResponseData: function (data) {
            let callbackFunction = function () {
                app.showScrollBar($('#hierarchyScroll'), {
                    height: '300px',
                    railVisible: true,
public_html/layouts/basic/modules/Accounts/resources/Detail.js on lines 41..55
public_html/layouts/basic/modules/Competition/resources/Detail.js on lines 24..38
public_html/layouts/basic/modules/Contacts/resources/Detail.js on lines 77..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 138.

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

        displayHierarchyResponseData: function (data) {
            let callbackFunction = function () {
                app.showScrollBar($('#hierarchyScroll'), {
                    height: '300px',
                    railVisible: true,
public_html/layouts/basic/modules/Accounts/resources/Detail.js on lines 41..55
public_html/layouts/basic/modules/Contacts/resources/Detail.js on lines 77..91
public_html/layouts/basic/modules/Project/resources/Detail.js on lines 78..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 138.

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

        displayHierarchyResponseData: function (data) {
            let callbackFunction = function () {
                app.showScrollBar($('#hierarchyScroll'), {
                    height: '300px',
                    railVisible: true,
public_html/layouts/basic/modules/Accounts/resources/Detail.js on lines 41..55
public_html/layouts/basic/modules/Competition/resources/Detail.js on lines 24..38
public_html/layouts/basic/modules/Project/resources/Detail.js on lines 78..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 138.

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

        displayAccountHierarchyResponseData: function (data) {
            let callbackFunction = function () {
                app.showScrollBar($('#hierarchyScroll'), {
                    height: '300px',
                    railVisible: true,
public_html/layouts/basic/modules/Competition/resources/Detail.js on lines 24..38
public_html/layouts/basic/modules/Contacts/resources/Detail.js on lines 77..91
public_html/layouts/basic/modules/Project/resources/Detail.js on lines 78..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 138.

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

        \App\DB::getInstance('log')->createCommand()->insert('o_#__access_for_user', [
            'username' => empty($userName) ? '-' : $userName,
            'date' => date('Y-m-d H:i:s'),
            'ip' => \App\TextUtils::textTruncate(\App\RequestUtil::getRemoteIP(), 100, false),
            'module' => $request->getModule(),
Severity: Major
Found in app/Exceptions/NoPermitted.php and 1 other location - About 5 hrs to fix
app/Exceptions/NoPermittedForAdmin.php on lines 29..38

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

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 (!empty($conditions)) {
            foreach ($conditions as $index => $condition) {
                $columns = $condition['columns'];
                if ('1' == $index && empty($columns)) {
                    $wfCondition[] = ['fieldname' => '', 'operation' => '', 'value' => '', 'valuetype' => '',
Severity: Major
Found in modules/Vtiger/helpers/AdvancedFilter.php and 1 other location - About 5 hrs to fix
modules/Settings/MappedFields/models/Module.php on lines 345..360

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

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

        $data = [
            'username' => empty($userName) ? '-' : $userName,
            'date' => date('Y-m-d H:i:s'),
            'ip' => \App\TextUtils::textTruncate(\App\RequestUtil::getRemoteIP(), 100, false),
            'module' => $request->getModule(),
Severity: Major
Found in app/Exceptions/NoPermittedForAdmin.php and 1 other location - About 5 hrs to fix
app/Exceptions/NoPermitted.php on lines 23..32

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

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 (!empty($conditions)) {
            foreach ($conditions as $index => $condition) {
                $columns = $condition['columns'];
                if ('1' == $index && empty($columns)) {
                    $wfCondition[] = ['fieldname' => '', 'operation' => '', 'value' => '', 'valuetype' => '',
Severity: Major
Found in modules/Settings/MappedFields/models/Module.php and 1 other location - About 5 hrs to fix
modules/Vtiger/helpers/AdvancedFilter.php on lines 164..179

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

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

<?php
/**
 * OSSMail module config.
 *
 * @copyright YetiForce S.A.
Severity: Minor
Found in modules/OSSMail/ConfigTemplate.php - About 5 hrs to fix

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

        public function importInRelatedlist($modulenode, $moduleInstance, $inRelatedListNode)
        {
            $inRelModuleInstance = Module::getInstance($inRelatedListNode->inrelatedmodule);
            $label = $inRelatedListNode->label;
            $actions = false;
    Severity: Major
    Found in vtlib/Vtiger/PackageImport.php and 1 other location - About 5 hrs to fix
    vtlib/Vtiger/PackageImport.php on lines 1012..1033

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

    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 importRelatedlist($modulenode, $moduleInstance, $relatedlistnode)
        {
            $relModuleInstance = Module::getInstance($relatedlistnode->relatedmodule);
            $label = $relatedlistnode->label;
            $actions = false;
    Severity: Major
    Found in vtlib/Vtiger/PackageImport.php and 1 other location - About 5 hrs to fix
    vtlib/Vtiger/PackageImport.php on lines 1035..1056

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

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

        public function exportFields(ModuleBasic $moduleInstance, $blockid)
        {
            $dataReader = (new \App\Db\Query())->from('vtiger_field')->where(['tabid' => $moduleInstance->id, 'block' => $blockid])->createCommand()->query();
            if (0 === $dataReader->count()) {
                return;
    Severity: Minor
    Found in vtlib/Vtiger/PackageExport.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 recordsList has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function recordsList($params)
        {
            [$moduleName, $columns, $conditions, $viewIdOrName, $limit, $maxLength, $params] = array_pad(explode('|', $params, 7), 7, '');
            $paramsArray = $params ? self::parseFieldParam($params) : [];
            $cvId = 0;
    Severity: Minor
    Found in app/TextParser.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 parseConditions has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

        private function parseConditions(?array $conditions, \App\QueryGenerator $queryGenerator, string $html = '', bool $show = false): string
        {
            if (empty($conditions)) {
                return '';
            }
    Severity: Minor
    Found in app/TextParser/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 getAddressFieldValue has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getAddressFieldValue(string $type, string $fieldNameCrm, string $fieldName)
        {
            $methodName = 'getCrm' . \ucfirst($fieldNameCrm);
            if (!empty($fieldParsed = $this->getAddressDataByType($type))) {
                if (\method_exists($this, $methodName)) {
    Severity: Minor
    Found in app/Integrations/Magento/Synchronizer/Maps/Base.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 baseModuleTools has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function baseModuleTools(): int
        {
            $i = 0;
            $allUtility = $missing = $curentProfile2utility = [];
            foreach ((new \App\Db\Query())->from('vtiger_profile2utility')->all() as $row) {
    Severity: Minor
    Found in app/Db/Fixer.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 addTables has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

        public function addTables(Base $importer)
        {
            $this->logs .= "> start add tables ({$importer->dbType})\n";
            $startMain = microtime(true);
            foreach ($importer->tables as $tableName => $table) {
    Severity: Minor
    Found in app/Db/Importer.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 transferListSearchParamsToFilterCondition has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

        public function transferListSearchParamsToFilterCondition($searchParams, Settings_Vtiger_Module_Model $moduleModel)
        {
            if (empty($searchParams)) {
                return [];
            }
    Severity: Minor
    Found in modules/Settings/Vtiger/views/Pagination.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 34 (exceeds 5 allowed). Consider refactoring.
    Open

        public function process(App\Request $request)
        {
            \App\Log::trace('Start ' . __METHOD__);
            $qualifiedModule = $request->getModule(false);
            $viewer = $this->getViewer($request);
    Severity: Minor
    Found in modules/Settings/Workflows/views/Import.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 getCalendarActivities has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getCalendarActivities($mode, Vtiger_Paging_Model $pagingModel, $user, $recordId = false, $paramsMore = [])
        {
            $activities = [];
            $query = new \App\Db\Query();
            if (!$user) {
    Severity: Minor
    Found in modules/Home/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

    Severity
    Category
    Status
    Source
    Language