YetiForceCompany/YetiForceCRM

View on GitHub

Showing 306,333 of 306,333 total issues

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

<?php
/**
 * YetiForce shop YetiForceKanban file.
 *
 * @package App
Severity: Major
Found in app/YetiForce/Shop/Product/YetiForceKanban.php and 4 other locations - About 3 hrs to fix
app/YetiForce/Shop/Product/YetiForceAutoAssignment.php on lines 1..48
app/YetiForce/Shop/Product/YetiForceDav.php on lines 1..48
app/YetiForce/Shop/Product/YetiForceGeocoder.php on lines 1..48
app/YetiForce/Shop/Product/YetiForcePassword.php on lines 1..48

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

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

Settings_Groups_Record_Model has 31 functions (exceeds 20 allowed). Consider refactoring.
Open

class Settings_Groups_Record_Model extends Settings_Vtiger_Record_Model
{
    /** @var array Record changes */
    protected $changes = [];

Severity: Minor
Found in modules/Settings/Groups/models/Record.php - About 3 hrs to fix

    File Module.php has 326 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * Module Class for MappedFields Settings.
     *
    Severity: Minor
    Found in modules/Settings/MappedFields/models/Module.php - About 3 hrs to fix

      Function autoLink has 95 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  autoLink() {
                      let fillChar = '\u200B';
                      let sel = window.getSelection(),
                          range = sel.getRangeAt(0).cloneRange(),
                          offset,
      Severity: Major
      Found in public_html/layouts/resources/Fields.js - About 3 hrs to fix

        Method getHtmlConfig has 95 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function getHtmlConfig(array $options = [])
            {
                $config = \HTMLPurifier_Config::createDefault();
                $config->set('Core.Encoding', static::$defaultCharset);
                $config->set('Cache.SerializerPermissions', 0775);
        Severity: Major
        Found in app/Purifier.php - About 3 hrs to fix

          Method getWidgetTimeControl has 95 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getWidgetTimeControl($user, $time)
              {
                  if (!$time) {
                      return ['show_chart' => false];
                  }
          Severity: Major
          Found in modules/OSSTimeControl/dashboards/AllTimeControl.php - About 3 hrs to fix

            Method loadFieldInfo has 95 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function loadFieldInfo(): array
                {
                    if (null !== $this->fieldInfo) {
                        return $this->fieldInfo;
                    }
            Severity: Major
            Found in modules/Vtiger/models/Field.php - About 3 hrs to fix

              Method getValuesFromSource has 95 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function getValuesFromSource(App\Request $request, $moduleName = false)
                  {
                      $sourceModule = $request->getByType('sourceModule', 2);
                      if (
                          empty($sourceModule)
              Severity: Major
              Found in modules/Vtiger/models/Module.php - About 3 hrs to fix

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

                            AppConnector.request(params)
                                .done(function (data) {
                                    var response = data['result'];
                                    var result = response['success'];
                                    if (result == true) {
                public_html/layouts/basic/modules/Settings/Profiles/resources/Profiles.js on lines 337..349
                public_html/layouts/basic/modules/Settings/Roles/resources/Roles.js on lines 228..240

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

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

                        AppConnector.request(params)
                            .done(function (data) {
                                var response = data['result'];
                                var result = response['success'];
                                if (result == true) {
                public_html/layouts/basic/modules/Settings/Profiles/resources/Profiles.js on lines 337..349
                public_html/layouts/basic/modules/Settings/Vtiger/resources/Tax.js on lines 215..227

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

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

                                AppConnector.request(params)
                                    .done(function (data) {
                                        progressIndicator.progressIndicator({ mode: 'hide' });
                                        let messageParams = {};
                                        messageParams['text'] = data.result.message;
                public_html/layouts/basic/modules/Settings/Mail/resources/Autologin.js on lines 22..31
                public_html/layouts/basic/modules/Settings/Mail/resources/Autologin.js on lines 49..58

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

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

                                AppConnector.request(params)
                                    .done(function (data) {
                                        progressIndicator.progressIndicator({ mode: 'hide' });
                                        var params = {};
                                        params['text'] = data.result.message;
                public_html/layouts/basic/modules/Settings/Mail/resources/Autologin.js on lines 49..58
                public_html/layouts/basic/modules/Settings/Mail/resources/Config.js on lines 20..29

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

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

                        AppConnector.request(params)
                            .done(function (data) {
                                var response = data['result'];
                                var result = response['success'];
                                if (result == true) {
                public_html/layouts/basic/modules/Settings/Roles/resources/Roles.js on lines 228..240
                public_html/layouts/basic/modules/Settings/Vtiger/resources/Tax.js on lines 215..227

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

                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

                            AppConnector.request(params)
                                .done(function (data) {
                                    progressIndicatorElement.progressIndicator({ mode: 'hide' });
                                    var params = {};
                                    params['text'] = app.vtranslate('JS_BLOCK_SEQUENCE_UPDATED');
                public_html/layouts/basic/modules/Settings/Search/resources/Search.js on lines 179..188

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

                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

                        AppConnector.request(params)
                            .done(function (data) {
                                progressIndicatorElement.progressIndicator({ mode: 'hide' });
                                var params = {};
                                params['text'] = app.vtranslate('JS_MODULES_SEQUENCE_UPDATED');
                public_html/layouts/basic/modules/Settings/LayoutEditor/resources/LayoutEditor.js on lines 71..80

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

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

                                AppConnector.request(params)
                                    .done(function (data) {
                                        progressIndicator.progressIndicator({ mode: 'hide' });
                                        var params = {};
                                        params['text'] = data.result.message;
                public_html/layouts/basic/modules/Settings/Mail/resources/Autologin.js on lines 22..31
                public_html/layouts/basic/modules/Settings/Mail/resources/Config.js on lines 20..29

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

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

                <?php
                /* +***********************************************************************************
                 * The contents of this file are subject to the vtiger CRM Public License Version 1.0
                 * ("License"); You may not use this file except in compliance with the License
                 * The Original Code is:  vtiger CRM Open Source
                Severity: Minor
                Found in modules/Settings/PickListDependency/models/Record.php - About 3 hrs to fix

                  Function getPopUp has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          getPopUp: function (container) {
                              const thisInstance = this;
                              if (typeof container === 'undefined') {
                                  container = thisInstance.getFilterContainer();
                              }
                  Severity: Major
                  Found in public_html/layouts/basic/modules/Vtiger/resources/AdvanceFilterEx.js - About 3 hrs to fix

                    Function addTimeControl has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                    Open

                            addTimeControl(params, callback = () => {}) {
                                let aDeferred = jQuery.Deferred();
                                let referenceModuleName = 'OSSTimeControl';
                                let parentId = params.recordId;
                                let parentModule = 'HelpDesk';
                    Severity: Minor
                    Found in public_html/layouts/basic/modules/HelpDesk/resources/Detail.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 throwNewException has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static function throwNewException($e, $die = true, $messageHeader = 'LBL_ERROR')
                        {
                            if (!headers_sent() && \App\Config::security('cspHeaderActive')) {
                                header("content-security-policy: default-src 'self' 'nonce-" . \App\Session::get('CSP_TOKEN') . "'; object-src 'none';base-uri 'self'; frame-ancestors 'self';");
                            }
                    Severity: Minor
                    Found in vtlib/Vtiger/Functions.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

                    Severity
                    Category
                    Status
                    Source
                    Language