YetiForceCompany/YetiForceCRM

View on GitHub

Showing 306,333 of 306,333 total issues

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

    public static function isNewMessagesForGlobal(int $userId): bool
    {
        $subQueryGlobal = (new Db\Query())
            ->select([
                static::COLUMN_NAME['message']['global'],
Severity: Major
Found in app/Chat.php and 1 other location - About 7 hrs to fix
app/Chat.php on lines 772..788

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

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 isNewMessagesForPrivate(int $userId): bool
    {
        $subQuery = (new Db\Query())
            ->select([
                static::COLUMN_NAME['message']['private'],
Severity: Major
Found in app/Chat.php and 1 other location - About 7 hrs to fix
app/Chat.php on lines 747..763

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

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

    private static function getPluralized($count)
    {
        //Extract language code from locale with special cases
        if (0 === strcasecmp(static::getLanguage(), 'pt-BR')) {
            $lang = 'pt-BR';
Severity: Major
Found in app/Language.php - About 7 hrs to fix

    Users_Record_Model has 55 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Users_Record_Model extends Vtiger_Record_Model
    {
        /** {@inheritdoc} */
        public function getModule(): Vtiger_Module_Model
        {
    Severity: Major
    Found in modules/Users/models/Record.php - About 7 hrs to fix

      File CustomView.php has 492 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * Custom view file.
       *
       * @package App
      Severity: Minor
      Found in app/CustomView.php - About 7 hrs to fix

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

            registerSelectAllDeleteActionsEvent: function () {
                var modulesMainCheckBox = jQuery('#mainModulesCheckBox');
                var mainViewActionCheckBox = jQuery('#mainAction4CheckBox');
                var deleteActionCheckBoxes = jQuery('.action2CheckBox');
                var mainDeleteActionCheckBox = jQuery('#mainAction2CheckBox');
        public_html/layouts/basic/modules/Settings/Profiles/resources/Profiles.js on lines 172..190
        public_html/layouts/basic/modules/Settings/Profiles/resources/Profiles.js on lines 212..230

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

        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

            registerSelectAllEditActionsEvent: function () {
                var modulesMainCheckBox = jQuery('#mainModulesCheckBox');
                var mainViewActionCheckBox = jQuery('#mainAction4CheckBox');
                var editActionCheckBoxes = jQuery('.action1CheckBox');
                var mainEditActionCheckBox = jQuery('#mainAction1CheckBox');
        public_html/layouts/basic/modules/Settings/Profiles/resources/Profiles.js on lines 192..210
        public_html/layouts/basic/modules/Settings/Profiles/resources/Profiles.js on lines 212..230

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

        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

            registerSelectAllCreateActionsEvent: function () {
                var modulesMainCheckBox = jQuery('#mainModulesCheckBox');
                var mainViewActionCheckBox = jQuery('#mainAction4CheckBox');
                var createActionCheckBoxes = jQuery('.action7CheckBox');
                var mainCreateActionCheckBox = jQuery('#mainAction7CheckBox');
        public_html/layouts/basic/modules/Settings/Profiles/resources/Profiles.js on lines 172..190
        public_html/layouts/basic/modules/Settings/Profiles/resources/Profiles.js on lines 192..210

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

        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 process(Vtiger_Record_Model $recordModel)
            {
                $badgeLink = \Vtiger_Relation_Model::getInstance(\Vtiger_Module_Model::getInstance($recordModel->getModuleName()), \Vtiger_Module_Model::getInstance($this->reference))->getListUrl($recordModel);
                $query = (new App\Db\Query())->from('vtiger_projecttask')
                    ->innerJoin('vtiger_crmentity', 'vtiger_projecttask.projecttaskid = vtiger_crmentity.crmid')
        Severity: Major
        Found in modules/Project/summary_blocks/Tasks.php and 1 other location - About 7 hrs to fix
        modules/Project/summary_blocks/Milestones.php on lines 41..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 241.

        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 process(Vtiger_Record_Model $recordModel)
            {
                $badgeLink = \Vtiger_Relation_Model::getInstance(\Vtiger_Module_Model::getInstance($recordModel->getModuleName()), \Vtiger_Module_Model::getInstance($this->reference))->getListUrl($recordModel);
                $query = (new App\Db\Query())->from('vtiger_projectmilestone')
                    ->innerJoin('vtiger_crmentity', 'vtiger_projectmilestone.projectmilestoneid = vtiger_crmentity.crmid')
        Severity: Major
        Found in modules/Project/summary_blocks/Milestones.php and 1 other location - About 7 hrs to fix
        modules/Project/summary_blocks/Tasks.php on lines 41..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 241.

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

            public function doTask($recordModel)
            {
                $fieldValueMapping = [];
                if (!empty($this->field_value_mapping)) {
                    $fieldValueMapping = \App\Json::decode($this->field_value_mapping);
        Severity: Minor
        Found in modules/com_vtiger_workflow/tasks/VTUpdateRelatedFieldTask.php - About 7 hrs to fix

        Cognitive Complexity

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

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

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

        Further reading

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

                filterFiles(files) {
                    let valid = [],
                        error = [];
                    if (files.length + this.files.length > this.options.limit) {
                        error.push({ error: { text: `${app.vtranslate('JS_FILE_LIMIT')} [${this.options.limit}]` } });
        Severity: Major
        Found in public_html/layouts/resources/app.js and 1 other location - About 7 hrs to fix
        public_html/layouts/resources/Fields.js on lines 3500..3511

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

        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

                filterFiles(files) {
                    let valid = [],
                        error = [];
                    if (files.length + this.files.length > this.options.limit) {
                        error.push({ error: { text: `${app.vtranslate('JS_FILE_LIMIT')} [${this.options.limit}]` } });
        Severity: Major
        Found in public_html/layouts/resources/Fields.js and 1 other location - About 7 hrs to fix
        public_html/layouts/resources/app.js on lines 1042..1053

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

        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

            public function validate($value, $isUserFormat = false)
            {
                if (empty($value) || isset($this->validate[$value])) {
                    return;
                }
        Severity: Major
        Found in modules/Vtiger/uitypes/Owner.php and 2 other locations - About 7 hrs to fix
        modules/Vtiger/uitypes/CurrencyList.php on lines 15..32
        modules/Vtiger/uitypes/Reference.php on lines 30..46

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

        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

            public function validate($value, $isUserFormat = false)
            {
                if (empty($value) || isset($this->validate[$value])) {
                    return;
                }
        Severity: Major
        Found in modules/Vtiger/uitypes/Reference.php and 2 other locations - About 7 hrs to fix
        modules/Vtiger/uitypes/CurrencyList.php on lines 15..32
        modules/Vtiger/uitypes/Owner.php on lines 53..69

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

        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

            public function validate($value, $isUserFormat = false)
            {
                if (empty($value) || isset($this->validate[$value])) {
                    return;
                }
        Severity: Major
        Found in modules/Vtiger/uitypes/CurrencyList.php and 2 other locations - About 7 hrs to fix
        modules/Vtiger/uitypes/Owner.php on lines 53..69
        modules/Vtiger/uitypes/Reference.php on lines 30..46

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

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

            public static function getDateRangeByType($type, $dateObject = null)
            {
                $currentUser = \App\User::getCurrentUserModel();
                $weekStartDay = $currentUser->getDetail('dayoftheweek');
        
        
        Severity: Major
        Found in include/fields/DateTimeRange.php - About 7 hrs to fix

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

          <?php
          
          /**
           * Inventory DiscountMode Field Class.
           *
          Severity: Major
          Found in modules/Vtiger/inventoryfields/DiscountMode.php and 1 other location - About 7 hrs to fix
          modules/Vtiger/inventoryfields/TaxMode.php on lines 1..44

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

          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
          
          /**
           * Inventory TaxMode Field Class.
           *
          Severity: Major
          Found in modules/Vtiger/inventoryfields/TaxMode.php and 1 other location - About 7 hrs to fix
          modules/Vtiger/inventoryfields/DiscountMode.php on lines 1..44

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

          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 AdvanceFilter.js has 486 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /*+***********************************************************************************
           * 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
           * The Initial Developer of the Original Code is vtiger.
            Severity
            Category
            Status
            Source
            Language