Showing 4,217 of 4,217 total issues

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_deposit.class.php and 1 other location - About 1 day to fix
plugins/payment/admin_modules/yf_manage_payout.class.php on lines 315..354

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

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

    public function _get_info_from_db()
    {
        if ( ! empty($this->info)) {
            return false;
        }
Severity: Major
Found in plugins/sys/classes/yf_sites_info.class.php and 1 other location - About 1 day to fix
plugins/sys/classes/core_api/yf_core_api_sites_info.class.php on lines 26..52

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

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 _get_info_from_db()
    {
        if ( ! empty($this->info)) {
            return false;
        }
plugins/sys/classes/yf_sites_info.class.php on lines 44..75

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

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

    public function compare_table($t1, $t2, $db_prefix)
    {
        $prefix_len = strlen($db_prefix);
        $columns = [];
        $indexes = [];
Severity: Minor
Found in plugins/db/classes/db/yf_db_migrator.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

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

<?php

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

    File yf_utils.class.php has 639 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    class yf_utils
    {
        /**
    Severity: Major
    Found in classes/yf_utils.class.php - About 1 day to fix

      yf_db_utils_driver has 76 functions (exceeds 20 allowed). Consider refactoring.
      Open

      abstract class yf_db_utils_driver
      {
          /**
           * Catch missing method call.
           * @param mixed $name
      Severity: Major
      Found in plugins/db/classes/db/yf_db_utils_driver.class.php - About 1 day to fix

        Function _add has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring.
        Open

            public function _add($params = [])
            {
                if (empty(main()->USER_ID) && MAIN_TYPE_USER && ! $params['allow_guests_posts']) {
                    return '';
                }
        Severity: Minor
        Found in plugins/comments/modules/comments/yf_comments_manage.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

        Function _show has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring.
        Open

            public function _show($params = [])
            {
        
                // Set cookie
                if (empty($_COOKIE['advertise']) && $_GET['ads_places'] == 1) {
        Severity: Minor
        Found in plugins/common/modules/yf_advertising.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

        File yf_payment_api__provider_bitaps.class.php has 632 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        _class('payment_api__provider_remote');
        
        class yf_payment_api__provider_bitaps extends yf_payment_api__provider_remote
        Severity: Major
        Found in plugins/payment/classes/yf_payment_api__provider_bitaps.class.php - About 1 day to fix

          File tpl_driver_yf_core_test.Test.php has 632 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          require_once __DIR__ . '/tpl__setup.php';
          
          class tpl_driver_yf_core_test extends tpl_abstract
          Severity: Major
          Found in .dev/tests/unit/tpl/tpl_driver_yf_core_test.Test.php - About 1 day to fix

            class_validate_test has 75 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class class_validate_test extends yf\tests\wrapper
            {
                public static function tearDownAfterClass() : void
                {
                    common()->USER_ERRORS = [];
            Severity: Major
            Found in .dev/tests/unit/class_validate_test.Test.php - About 1 day to fix

              File yf_admin_methods.class.php has 629 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              /**
               * Common admin methods hidden by simple api.
               *
              Severity: Major
              Found in plugins/sys/classes/yf_admin_methods.class.php - About 1 day to fix

                Function strip_tags_smart has a Cognitive Complexity of 70 (exceeds 5 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: Minor
                Found in functions/yf_strip_tags_smart.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

                File yf_dir.class.php has 625 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                /**
                 * Filesystem utils.
                 *
                Severity: Major
                Found in classes/yf_dir.class.php - About 1 day to fix

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

                                  function( r ) {
                                      $scope.block_wait   = false;
                                      $scope.is_submitted = false;
                                      if( r.response && r.response.payout ) {
                                          $scope.status            = r.response.payout.status;
                  plugins/content/templates/user/js/ng/payment/balance-recharge.js on lines 532..552

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

                  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

                                  function( r ) {
                                      $scope.block_wait   = false;
                                      $scope.is_submitted = false;
                                      if( r.response && r.response.payout ) {
                                          $scope.status            = r.response.cancel.status;
                  plugins/content/templates/user/js/ng/payment/balance-recharge.js on lines 487..507

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

                  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_add_foreign_key()
                      {
                          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 1 day to fix
                  .dev/tests/functional/db/class_db_real_utils_pgsql.TODO.php on lines 520..537

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

                  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_foreign_key_info()
                      {
                          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 1 day to fix
                  .dev/tests/functional/db/class_db_real_utils_pgsql.TODO.php on lines 576..593

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

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

                      public function _multi_request($urls, $options = [], $max_threads = 0, &$requests_info = [])
                      {
                          if ( ! $max_threads) {
                              $max_threads = $this->CURL_DEF_MAX_THREADS;
                          }
                  Severity: Minor
                  Found in plugins/common/classes/common/yf_remote_files.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

                  Severity
                  Category
                  Status
                  Source
                  Language