Showing 4,217 of 4,217 total issues

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

    public function _show_filter()
    {
        $object = &$this->object;
        $action = &$this->action;
        $filter_name = &$this->filter_name;
Severity: Major
Found in plugins/payment/admin_modules/yf_manage_payout.class.php and 4 other locations - About 4 hrs to fix
plugins/payment/admin_modules/yf_manage_currency.class.php on lines 96..126
plugins/payment/admin_modules/yf_manage_deposit.class.php on lines 176..206
plugins/payment/admin_modules/yf_manage_payment_operation.class.php on lines 142..172
plugins/payment/admin_modules/yf_manage_transfer.class.php on lines 167..197

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

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

    public function _show_filter()
    {
        $object = &$this->object;
        $action = &$this->action;
        $filter_name = &$this->filter_name;
Severity: Major
Found in plugins/payment/admin_modules/yf_manage_deposit.class.php and 4 other locations - About 4 hrs to fix
plugins/payment/admin_modules/yf_manage_currency.class.php on lines 96..126
plugins/payment/admin_modules/yf_manage_payment_operation.class.php on lines 142..172
plugins/payment/admin_modules/yf_manage_payout.class.php on lines 228..258
plugins/payment/admin_modules/yf_manage_transfer.class.php on lines 167..197

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

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

#!/usr/bin/env php
<?php

require_once dirname(__DIR__) . '/scripts_init.php';

Severity: Major
Found in .dev/scripts/languages/languages_into_db.php and 2 other locations - About 4 hrs to fix
.dev/scripts/currencies/currencies_into_db.php on lines 1..20
.dev/scripts/google_webfonts/google_fonts_into_db.php on lines 1..21

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

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

    public function _render_get_data(&$params)
    {
        $default_per_page = MAIN_TYPE_USER ? conf('user_per_page') : conf('admin_per_page');
        if ($params['rotate_table']) {
            $default_per_page = 10;
Severity: Major
Found in plugins/table2/classes/yf_table2.class.php - About 4 hrs to fix

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

        public function test_table_exists()
        {
            if ($this->_need_skip_test(__FUNCTION__)) {
                return;
            }
    .dev/tests/functional/db/class_db_real_utils_pgsql.TODO.php on lines 88..99

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

    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 test_table_exists()
        {
            if ($this->_need_skip_test(__FUNCTION__)) {
                return;
            }
    Severity: Major
    Found in .dev/tests/functional/db/class_db_real_utils_pgsql.TODO.php and 1 other location - About 4 hrs to fix
    .dev/tests/functional/db/class_db_real_utils_mysql_test.Test.php on lines 205..216

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

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

    function strip_tags_smart(
        /*string*/ $s,
        array $allowable_tags = null,
        /*boolean*/ $is_format_spaces = true,
        array $pair_tags = ['script', 'style', 'map', 'iframe', 'frameset', 'object', 'applet', 'comment', 'button'],
    Severity: Major
    Found in functions/yf_strip_tags_smart.php - About 4 hrs to fix

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

          public function _hook_widget__top_customers($params = [])
          {
              $meta = [
                  'name' => 'Shop: most active customers',
                  'desc' => 'List of most active customers',
      plugins/shop/admin_modules/manage_shop/yf_manage_shop_hook_widgets.class.php on lines 161..185

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

      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 _hook_widget__latest_customers($params = [])
          {
              $meta = [
                  'name' => 'Shop: new customers',
                  'desc' => 'List of latest customers, who bought something',
      plugins/shop/admin_modules/manage_shop/yf_manage_shop_hook_widgets.class.php on lines 131..156

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

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

          public function compare_table($t1, $t2, $db_prefix)
          {
              $prefix_len = strlen($db_prefix);
              $columns = [];
              $indexes = [];
      Severity: Major
      Found in plugins/db/classes/db/yf_db_migrator.class.php - About 4 hrs to fix

        Method translate_string has 119 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function translate_string($in, $args = 0, $lang = '')
            {
                if ( ! $in) {
                    return $in;
                }
        Severity: Major
        Found in plugins/locale/classes/yf_i18n.class.php - About 4 hrs to fix

          Method init_constants has 119 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function init_constants()
              {
                  $this->PROFILING && $this->_timing[] = [microtime(true), __CLASS__, __FUNCTION__, $this->trace_string(), func_get_args()];
                  // Save current working directory (to restore it later when execute shutdown functions)
                  $this->_CWD = getcwd();
          Severity: Major
          Found in classes/yf_main.class.php - About 4 hrs to fix

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

                public function _show_filter()
                {
                    if ( ! in_array($_GET['action'], ['show'])) {
                        return false;
                    }
            Severity: Major
            Found in plugins/user/admin_modules/yf_user_modules.class.php and 1 other location - About 4 hrs to fix
            plugins/admin/admin_modules/yf_admin_modules.class.php on lines 475..497

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 178.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                public function get_widgets()
                {
                    $data = [];
                    foreach (_class('core_api')->get_widgets() as $module => $hooks) {
                        $i++;
            Severity: Major
            Found in .dev/samples/classes/sample_core_api.class.php and 1 other location - About 4 hrs to fix
            .dev/samples/classes/sample_core_api.class.php on lines 275..299

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 178.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                public function get_hooks()
                {
                    $data = [];
                    foreach (_class('core_api')->get_all_hooks() as $module => $hooks) {
                        $i++;
            Severity: Major
            Found in .dev/samples/classes/sample_core_api.class.php and 1 other location - About 4 hrs to fix
            .dev/samples/classes/sample_core_api.class.php on lines 302..326

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 178.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                public function _show_filter()
                {
                    if ( ! in_array($_GET['action'], ['show'])) {
                        return false;
                    }
            Severity: Major
            Found in plugins/admin/admin_modules/yf_admin_modules.class.php and 1 other location - About 4 hrs to fix
            plugins/user/admin_modules/yf_user_modules.class.php on lines 463..485

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 178.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                        for ($j = $i + 1; $j < count((array) $tokens); ++$j) {
                            $subOffset += strlen(is_array($tokens[$j]) ? $tokens[$j][1] : $tokens[$j]);
            
                            if (is_string($tokens[$j]) && $tokens[$j] == '[') {
                                ++$openBracketsCount;
            Severity: Major
            Found in .dev/useful/php-short-array-syntax-converter/revert.php and 1 other location - About 4 hrs to fix
            .dev/useful/php-short-array-syntax-converter/convert.php on lines 103..121

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 178.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                        for ($j = $i + 1; $j < count((array) $tokens); ++$j) {
                            $subOffset += strlen(is_array($tokens[$j]) ? $tokens[$j][1] : $tokens[$j]);
            
                            if (is_string($tokens[$j]) && $tokens[$j] == '(') {
                                ++$openBracketsCount;
            Severity: Major
            Found in .dev/useful/php-short-array-syntax-converter/convert.php and 1 other location - About 4 hrs to fix
            .dev/useful/php-short-array-syntax-converter/revert.php on lines 108..125

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 178.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                public function _prepare_to_save($a)
                {
                    $to_save = [];
                    foreach ((array) $a as $k => $v) {
                        if (is_string($v) && ! strlen($v)) {
            Severity: Minor
            Found in plugins/conf/admin_modules/yf_settings.class.php - About 4 hrs to fix

            Cognitive Complexity

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

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

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

            Further reading

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

                public function join_url($parts, $encode = null)
                {
                    if ($encode === null) {
                        $encode = $this->AUTO_ENCODE_DECODE;
                    }
            Severity: Minor
            Found in plugins/common/classes/common/yf_url_to_absolute.class.php - About 4 hrs to fix

            Cognitive Complexity

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

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

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

            Further reading

            Severity
            Category
            Status
            Source
            Language