Showing 4,217 of 4,217 total issues

yf_assets has 81 functions (exceeds 20 allowed). Consider refactoring.
Open

class yf_assets
{
    /** @array */
    public $supported_asset_types = [
        'jquery', 'js', 'css', 'less', 'sass', 'coffee', 'bundle', 'asset', /*, 'img', 'font'*/
Severity: Major
Found in plugins/assets/classes/yf_assets.class.php - About 1 day to fix

    Method _api_transaction has 303 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function _api_transaction($options)
        {
            if ( ! $this->ENABLE) {
                return  null;
            }
    Severity: Major
    Found in plugins/payment/classes/yf_payment_api__provider_remote.class.php - About 1 day to fix

      Function _go has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring.
      Open

          public function _go($location, $rewrite = true, $redirect_type = 'hybrid', $text = '', $ttl = 3, $params = [])
          {
              if (is_array($location)) {
                  $params += $location;
                  $rewrite = isset($params['rewrite']) ? $params['rewrite'] : $rewrite;
      Severity: Minor
      Found in classes/yf_redirect.class.php - About 1 day 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

          public function test_strip_css_input()
          {
              $this->assertEquals('#some_id { display:none; }', _class('assets')->_strip_css_input('<style>#some_id { display:none; }</style>'));
              $this->assertEquals('#some_id { display:none; }', _class('assets')->_strip_css_input('<style>#some_id { display:none; }'));
              $this->assertEquals('#some_id { display:none; }', _class('assets')->_strip_css_input('#some_id { display:none; }</style>'));
      Severity: Major
      Found in .dev/tests/unit/class_assets_test.Test.php and 1 other location - About 1 day to fix
      .dev/tests/unit/class_assets_test.Test.php on lines 84..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 329.

      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_strip_js_input()
          {
              $this->assertEquals('$(function(){})', _class('assets')->_strip_js_input('<script>$(function(){})</script>'));
              $this->assertEquals('$(function(){})', _class('assets')->_strip_js_input('<script>$(function(){})'));
              $this->assertEquals('$(function(){})', _class('assets')->_strip_js_input('$(function(){})</script>'));
      Severity: Major
      Found in .dev/tests/unit/class_assets_test.Test.php and 1 other location - About 1 day to fix
      .dev/tests/unit/class_assets_test.Test.php on lines 102..117

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

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

      <?php
      
      /**
       * Categories editor.
       *
      Severity: Major
      Found in plugins/categories/admin_modules/yf_category_editor.class.php - About 1 day to fix

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

            public function test_foreach_exec()
            {
                // Some magick here with DI container, we link to this class :-)
                main()->modules['unittest2'] = $this;
                $data = ['k1' => 'v1', 'k2' => 'v2'];
        Severity: Major
        Found in .dev/tests/unit/tpl/tpl_driver_yf_foreach_test.Test.php and 1 other location - About 1 day to fix
        .dev/tests/unit/tpl/tpl_driver_yf_core_test.Test.php on lines 664..689

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

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

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

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

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

        Refactorings

        Further Reading

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

            public function test_foreach_exec()
            {
                // Some magick here with DI container, we link to this class :-)
                main()->modules['unittest2'] = $this;
                $data = ['k1' => 'v1', 'k2' => 'v2'];
        Severity: Major
        Found in .dev/tests/unit/tpl/tpl_driver_yf_core_test.Test.php and 1 other location - About 1 day to fix
        .dev/tests/unit/tpl/tpl_driver_yf_foreach_test.Test.php on lines 154..179

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 325.

        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_cleanup_33_2()
            {
                $closure = function ($in) {
                    return module('register')->_login_not_exists($in);
                };
        Severity: Major
        Found in .dev/tests/unit/class_validate_test.Test.php and 1 other location - About 1 day to fix
        .dev/tests/unit/class_validate_test.Test.php on lines 1148..1184

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

        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_cleanup_33_1()
            {
                $closure = function ($in) {
                    return module('register')->_login_not_exists($in);
                };
        Severity: Major
        Found in .dev/tests/unit/class_validate_test.Test.php and 1 other location - About 1 day to fix
        .dev/tests/unit/class_validate_test.Test.php on lines 1185..1221

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

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

        <?php
        
        return [
          2 => [
            'id' => '2',
        Severity: Major
        Found in .dev/install/installer_data/db_tables/sys_admin_modules.data.php - About 1 day to fix

          File user.sql_php.php has 658 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          return [
              'fields' => [
                  'id' => [
          Severity: Major
          Found in plugins/sys/share/db/sql_php/user.sql_php.php - About 1 day to fix

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

            <?php
            
            return [
                'fields' => [
                    'product_id' => [
            plugins/sys/share/db/sql_php/unread.sql_php.php on lines 1..57

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

            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
            
            return [
                'fields' => [
                    'module_name' => [
            Severity: Major
            Found in plugins/sys/share/db/sql_php/unread.sql_php.php and 1 other location - About 1 day to fix
            plugins/shop/share/db/sql_php/shop_products_productparams.sql_php.php on lines 1..57

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

            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_unicode_alpha_dash()
                {
                    $this->assertFalse(_class('validate')->unicode_alpha_dash(''));
                    $this->assertFalse(_class('validate')->unicode_alpha_dash(null));
                    $this->assertFalse(_class('validate')->unicode_alpha_dash(false));
            Severity: Major
            Found in .dev/tests/unit/class_validate_test.Test.php and 1 other location - About 1 day to fix
            .dev/tests/unit/class_validate_test.Test.php on lines 412..431

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

            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_unicode_alpha_numeric()
                {
                    $this->assertFalse(_class('validate')->unicode_alpha_numeric(''));
                    $this->assertFalse(_class('validate')->unicode_alpha_numeric(null));
                    $this->assertFalse(_class('validate')->unicode_alpha_numeric(false));
            Severity: Major
            Found in .dev/tests/unit/class_validate_test.Test.php and 1 other location - About 1 day to fix
            .dev/tests/unit/class_validate_test.Test.php on lines 456..475

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

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

                public function _get_modules_from_files($include_framework = true, $with_sub_modules = false)
                {
                    $user_modules_array = [];
                    $pattern_include = '-f ~/' . preg_quote(USER_MODULES_DIR, '~') . '.*' . preg_quote(YF_CLS_EXT, '~') . '$~';
                    $pattern_no_submodules = '~/' . preg_quote(USER_MODULES_DIR, '~') . '[^/]+' . preg_quote(YF_CLS_EXT, '~') . '$~ims';
            Severity: Minor
            Found in plugins/sys/classes/core_api/yf_core_api_user_modules.class.php - About 1 day 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

            #!/usr/bin/env php
            <?php
            
            require __DIR__ . '/github_api_funcs.php';
            
            
            Severity: Major
            Found in .dev/scripts/github/forks_show_branches_all.php and 1 other location - About 1 day to fix
            .dev/scripts/github/forks_show_branches.php on lines 1..35

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

            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

            #!/usr/bin/env php
            <?php
            
            require __DIR__ . '/github_api_funcs.php';
            
            
            Severity: Major
            Found in .dev/scripts/github/forks_show_branches.php and 1 other location - About 1 day to fix
            .dev/scripts/github/forks_show_branches_all.php on lines 1..35

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

            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_daily_data($days = null)
                {
                    $time = time();
                    $days = $days ?: 60;
                    $min_time = $time - $days * 86400;
            Severity: Major
            Found in plugins/payment/admin_modules/yf_manage_payout.class.php and 1 other location - About 1 day to fix
            plugins/payment/admin_modules/yf_manage_deposit.class.php on lines 263..302

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

            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