YetiForceCompany/YetiForceCRM

View on GitHub

Showing 306,333 of 306,333 total issues

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

<?php

/**
 * Settings mail autologin view class.
 *
Severity: Major
Found in modules/Settings/Mail/views/Autologin.php and 1 other location - About 3 hrs to fix
modules/Settings/Leads/views/MappingDetail.php on lines 1..37

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

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 lock(App\Request $request)
    {
        $module = $request->getInteger('srcModule');
        $members = $request->getArray('members', 'Text');
        $lock = $request->getBoolean('lock') ? 1 : 0;
Severity: Major
Found in modules/Settings/Notifications/actions/SaveAjax.php and 1 other location - About 3 hrs to fix
modules/Settings/Notifications/actions/SaveAjax.php on lines 29..47

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

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

<?php
/* +**********************************************************************************
 * The contents of this file are subject to the vtiger CRM Public License Version 1.1
 * ("License"); You may not use this file except in compliance with the License
 * The Original Code is:  vtiger CRM Open Source
Severity: Major
Found in modules/Settings/Leads/views/MappingDetail.php and 1 other location - About 3 hrs to fix
modules/Settings/Mail/views/Autologin.php on lines 1..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 161.

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

Method getTimeZones has 98 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function getTimeZones()
    {
        return [
            'Pacific/Midway',
            'Pacific/Samoa',
Severity: Major
Found in modules/Users/UserTimeZonesArray.php - About 3 hrs to fix

    Method imapConnect has 98 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function imapConnect($user, $password, $host = '', $folder = 'INBOX', $dieOnError = true, $config = [], array $account = [])
        {
            \App\Log::trace("Entering OSSMail_Record_Model::imapConnect($user , '****' , $folder) method ...");
            if (!$config) {
                $config = self::loadRoundcubeConfig();
    Severity: Major
    Found in modules/OSSMail/models/Record.php - About 3 hrs to fix

      Method process has 98 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function process(App\Request $request)
          {
              $userId = \App\User::getCurrentUserId();
              $viewer = $this->getViewer($request);
              $moduleName = $request->getModule();
      Severity: Major
      Found in modules/OSSMailView/dashboards/Graf.php - About 3 hrs to fix

        Function copySelectedOptions has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

                copySelectedOptions: function (source, destination) {
                    let srcObj = jQuery(source);
                    let destObj = jQuery(destination);
        
                    if (typeof srcObj === 'undefined' || typeof destObj === 'undefined') return;
        Severity: Minor
        Found in public_html/layouts/basic/modules/Import/resources/Import.js - About 3 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 testIfAllOperatorsExist has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

            public function testIfAllOperatorsExist()
            {
                foreach ((new \DirectoryIterator(ROOT_DIRECTORY . '/modules/Vtiger/uitypes/')) as $item) {
                    if ($item->isFile() && 'php' === $item->getExtension()) {
                        $fileName = $item->getBasename('.php');
        Severity: Minor
        Found in tests/App/Conditions.php - About 3 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 getModules has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function getModules(): array
            {
                $cacheName = 'InterestsConflict::getModules';
                if (\App\Cache::has($cacheName, '')) {
                    return \App\Cache::get($cacheName, '');
        Severity: Minor
        Found in app/Components/InterestsConflict.php - About 3 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 translate has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function translate(string $key, string $moduleName = '_Base', ?string $language = null, bool $encode = true, ?string $secondModuleName = null)
            {
                if (empty($key)) { // nothing to translate
                    return $key;
                }
        Severity: Minor
        Found in app/Language.php - About 3 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 checkIfDuplicateRecordExists has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

            public function checkIfDuplicateRecordExists()
            {
                if ($this->get('check_duplicate') && isset($this->fieldMapping['field_merge'][$this->destinyModuleModel->getId()])) {
                    $referenceDestinyField = $this->fieldMapping['field_merge'][$this->destinyModuleModel->getId()];
                    if ($referenceDestinyField) {
        Severity: Minor
        Found in app/RecordConverter.php - About 3 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 getArray has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getArray($key, $type = false, $value = [], ?string $keyType = null)
            {
                if (isset($this->purifiedValuesByArray[$key])) {
                    return $this->purifiedValuesByArray[$key];
                }
        Severity: Minor
        Found in app/Request.php - About 3 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 27 (exceeds 5 allowed). Consider refactoring.
        Open

            public function process()
            {
                if (!$this->textParser->recordModel || !$this->textParser->recordModel->getModule()->isInventory()) {
                    return '';
                }
        Severity: Minor
        Found in app/TextParser/TableCorrectTaxSummary.php - About 3 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 initializeListViewContents has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

            public function initializeListViewContents(App\Request $request, Vtiger_Viewer $viewer)
            {
                $moduleName = $request->getModule();
                $cvId = $request->getByType('viewname', 2);
                $pageNumber = $request->getInteger('page');
        Severity: Minor
        Found in modules/Users/views/List.php - About 3 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 global has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

            public function global(App\Request $request)
            {
                $moduleName = $request->getModule(false);
                $data = [];
                $type = 'global';
        Severity: Minor
        Found in modules/Settings/ApiAddress/actions/SaveConfig.php - About 3 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 getStats has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getStats($data, $langBase, $byModule)
            {
                $differences = [];
                $i = 0;
                foreach ($data as $id => $dataLang) {
        Severity: Minor
        Found in modules/Settings/LangManagement/models/Module.php - About 3 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 getHeaders has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getHeaders()
            {
                $fields = [];
                if ($this->get('viewId')) {
                    $moduleModel = $this->getRelationModel()->getRelationModuleModel();
        Severity: Minor
        Found in modules/Vtiger/models/RelationListView.php - About 3 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 getAutoCompleteField has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getAutoCompleteField($recordModel): array
            {
                $fields = [];
                $fieldsReferenceList = [];
                $excludedModules = ['Users'];
        Severity: Minor
        Found in modules/Vtiger/models/Relation.php - About 3 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 4 locations. Consider refactoring.
        Open

            createSwitch() {
                let on = app.vtranslate('JS_WORK_DAYS'),
                    off = app.vtranslate('JS_ALL'),
                    state = this.isSwitchAllDays;
                return `<div class="btn-group btn-group-toggle js-switch c-calendar-switch" data-toggle="buttons">
        public_html/layouts/basic/modules/Calendar/resources/CalendarQuickCreate.js on lines 79..91
        public_html/layouts/basic/modules/OSSTimeControl/resources/QuickCreate.js on lines 69..81
        public_html/layouts/basic/modules/Reservations/resources/QuickCreate.js on lines 69..81

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

        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

            createSwitch() {
                let on = app.vtranslate('JS_WORK_DAYS'),
                    off = app.vtranslate('JS_ALL'),
                    state = this.isSwitchAllDays;
                return `<div class="btn-group btn-group-toggle js-switch c-calendar-switch" data-toggle="buttons">
        public_html/layouts/basic/modules/Calendar/resources/CalendarQuickCreate.js on lines 79..91
        public_html/layouts/basic/modules/Occurrences/resources/QuickCreate.js on lines 69..81
        public_html/layouts/basic/modules/Reservations/resources/QuickCreate.js on lines 69..81

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

        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