Showing 3,246 of 4,217 total issues

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

<?php

// TODO: connect subclasses from manage_sphinx/, do refactoring from subclasses into closures

class yf_manage_sphinx
Severity: Major
Found in plugins/search/admin_modules/yf_manage_sphinx.class.php - About 1 day to fix

    Method product_edit has 229 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function product_edit()
        {
            $id = (int) $_GET['id'];
            $_GET['id'] = $id;
            if (empty($id)) {

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

      <?php
      
      /**
       * Caching layer.
       *
      Severity: Major
      Found in plugins/cache/classes/yf_cache.class.php - About 1 day to fix

        Function repair has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
        Open

            public function repair($sql, $db_error, $db)
            {
                $sql = trim($sql);
                // #1191 Can't find FULLTEXT index matching the column list
                if (in_array($db_error['code'], [1191]) && $this->RESTORE_FULLTEXT_INDEX) {
        Severity: Minor
        Found in plugins/db/classes/db/yf_db_installer_mysql.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

        yf_payment_test has 61 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class yf_payment_test
        {
            public $api = [
                // 'Privat24'    => true,
                // 'LiqPay'      => true,
        Severity: Major
        Found in plugins/payment/modules/yf_payment_test.class.php - About 1 day to fix

          yf_wrapper_ethereum has 61 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class yf_wrapper_ethereum
          {
              public $host = '127.0.0.1';
              public $port = 8545;
              public $version = '2.0';
          Severity: Major
          Found in plugins/ethereum/classes/yf_wrapper_ethereum.class.php - About 1 day to fix

            Method change_location has 219 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function change_location()
                {
                    if ( ! main()->USE_GEO_IP) {
                        return false;
                    }
            Severity: Major
            Found in plugins/geo/modules/yf_geo_content.class.php - About 1 day to fix

              Function _external_response has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function _external_response($options)
                  {
                      $operation_id = $options['operation_id'];
                      $payment_code = $options['code'] ?: '';
                      $address = $options['address'] ?: '';
              Severity: Minor
              Found in plugins/payment/classes/yf_payment_api__provider_bitaps.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 tasks has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function tasks($allowed_check = false)
                  {
                      $main = main();
                      if ($main->is_console() || $main->is_ajax()) {
                          $main->no_graphics(true);
              Severity: Minor
              Found in plugins/sys/classes/yf_core_blocks.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 login has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function login($provider, $params = [])
                  {
                      if ( ! $provider) {
                          return false;
                      }
              Severity: Minor
              Found in plugins/oauth/classes/yf_oauth.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_img_resizes.sql_php.php has 526 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_img_resizes.sql_php.php - About 1 day to fix

                Function add has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function add($content, $asset_type = 'bundle', $content_type_hint = 'auto', $params = [])
                    {
                        if (DEBUG_MODE) {
                            $trace = main()->trace_string();
                        }
                Severity: Minor
                Found in plugins/assets/classes/yf_assets.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_file_manager.class.php has 521 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                /**
                 * File manager module.
                 *
                Severity: Major
                Found in plugins/sys/admin_modules/yf_file_manager.class.php - About 1 day to fix

                  yf_core_api has 59 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class yf_core_api
                  {
                      public $section_paths = [
                          'core' => 'classes/',
                          'user' => 'modules/',
                  Severity: Major
                  Found in plugins/sys/classes/yf_core_api.class.php - About 1 day to fix

                    yf_shop has 59 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class yf_shop extends yf_module
                    {
                        /* Test CC numbers:
                    
                        370000000000002 American Express Test Card
                    Severity: Major
                    Found in plugins/shop/modules/yf_shop.class.php - About 1 day to fix

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

                      <?php
                      
                      
                      require_once __DIR__ . '/yf_unit_tests_setup.php';
                      
                      
                      Severity: Major
                      Found in .dev/tests/unit/class_form_test.Test.php - About 1 day to fix

                        Function auto has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function auto($table = '', $id = '', $params = [], $form)
                            {
                                if ($params['links_add']) {
                                    $form->_params['links_add'] = $params['links_add'];
                                }
                        Severity: Minor
                        Found in plugins/form2/classes/form2/yf_form2_auto.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 _upload_item__import_test has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function _upload_item__import_test($options)
                            {
                                // load import data
                                $_ = $options;
                                $id = $_['id'];

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

                            public function _get_methods($params = [])
                            {
                                $ONLY_PRIVATE_METHODS = [];
                                if (isset($params['private'])) {
                                    $ONLY_PRIVATE_METHODS = $params['private'];
                        Severity: Minor
                        Found in plugins/user/admin_modules/yf_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

                        class_db_offline_query_builder_test has 58 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        class class_db_offline_query_builder_test extends db_offline_abstract
                        {
                            public function test_select_star()
                            {
                                if ($this->_need_skip_test(__FUNCTION__)) {
                        Severity: Major
                        Found in .dev/tests/unit/db/class_db_offline_query_builder_test.Test.php - About 1 day to fix
                          Severity
                          Category
                          Status
                          Source
                          Language