Showing 4,217 of 4,217 total issues

Function table_get_columns has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    public function table_get_columns($table, $extra = [], &$error = false)
    {
        if (is_array($table)) {
            $extra = (array) $extra + $table;
            $table = '';
Severity: Minor
Found in plugins/db/classes/db/yf_db_utils_driver.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 create_table has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    public function create_table($table, $extra = [], &$error = false)
    {
        // Example callable: create_table($name, function($t) { $t->int('id', 10); });
        if (is_callable($extra)) {
            if (strpos($table, '.') !== false) {
Severity: Minor
Found in plugins/db/classes/db/yf_db_utils_driver.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 multi_get has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    public function multi_get($names = [], $force_ttl = 0, $params = [])
    {
        $do_real_work = true;
        if ( ! $this->_driver_ok || $this->NO_CACHE) {
            $do_real_work = false;
Severity: Minor
Found in plugins/cache/classes/yf_cache.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 connect has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    public function connect($server_info = [])
    {
        if ( ! $this->_INIT_OK || ! $server_info) {
            return false;
        }
Severity: Minor
Found in plugins/ssh/classes/yf_ssh.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 tip has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    public function tip($in = null, $extra = [])
    {
        if ( ! is_array($extra)) {
            $extra = [];
        }
Severity: Minor
Found in classes/yf_graphics.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 _do_debug_db_connection_queries has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    public function _do_debug_db_connection_queries($db, $connect_trace = [])
    {
        if ( ! $this->SHOW_DB_QUERY_LOG) {
            return '';
        }
Severity: Minor
Found in classes/yf_debug.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

Method write_string has 106 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function write_string($server_info = [], $string = '', $remote_file = '')
    {
        $remote_file = _class('ssh')->_prepare_path($remote_file);
        if ( ! _class('ssh')->_INIT_OK || ! $server_info || ! $string || ( ! strlen($remote_file) && ! is_array($string))) {
            return false;
Severity: Major
Found in plugins/ssh/classes/ssh/yf_ssh_files.class.php - About 4 hrs to fix

    Method test_complex has 106 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function test_complex()
        {
            $to_merge_1 = [
                'auth_user' => [
                    'EXEC_AFTER_LOGIN' => [
    Severity: Major
    Found in .dev/tests/unit/functions/function_my_array_merge_test.Test.php - About 4 hrs to fix

      Method tasks has 105 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function tasks($allowed_check = false)
          {
              $main = main();
              if ($main->is_console() || $main->is_ajax()) {
                  $main->no_graphics(true);
      Severity: Major
      Found in plugins/sys/classes/yf_core_blocks.class.php - About 4 hrs to fix

        File articles_texts.data.php has 341 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        return [
          7 => [
            'id' => '7',
        Severity: Minor
        Found in .dev/install/installer_data/db_tables_uk/articles_texts.data.php - About 4 hrs to fix

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

              protected function _field_test__manufacturer_id($value, $action)
              {
                  $value = (int) $value;
                  $valid = $value >= 0;
                  ! $valid && $status_message = 'неверный код производителя';
          plugins/shop/admin_modules/manage_shop/yf_manage_shop_import_products2.class.php on lines 1282..1302

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

          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

              protected function _field_test__supplier_id($value, $action)
              {
                  $value = (int) $value;
                  $valid = $value >= 0;
                  ! $valid && $status_message = 'неверный код поставщика';
          plugins/shop/admin_modules/manage_shop/yf_manage_shop_import_products2.class.php on lines 1236..1256

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

          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

          yf_payment_api__provider_remote has 33 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class yf_payment_api__provider_remote
          {
              public $ENABLE = null;
              public $TEST_MODE = null;
          
          
          Severity: Minor
          Found in plugins/payment/classes/yf_payment_api__provider_remote.class.php - About 4 hrs to fix

            sample_core_api has 33 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class sample_core_api
            {
                public function _init()
                {
                    _class('core_api')->SOURCE_ONLY_FRAMEWORK = true;
            Severity: Minor
            Found in .dev/samples/classes/sample_core_api.class.php - About 4 hrs to fix

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

              <?php
              
              /**
               * Static/HTML pages content editor.
               *
              Severity: Minor
              Found in plugins/static_pages/admin_modules/yf_static_pages.class.php - About 4 hrs to fix

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

                <?php
                
                /**
                 * Custom error handler.
                 *
                Severity: Minor
                Found in plugins/sys/classes/yf_core_errors.class.php - About 4 hrs to fix

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

                  <?php
                  
                  return [
                      'fields' => [
                          'id' => [
                  Severity: Minor
                  Found in plugins/sys/share/db/sql_php/sys_category_items.sql_php.php - About 4 hrs to fix

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

                        public function event_exists($name, $extra = [], &$error = false)
                        {
                            if (strpos($name, '.') !== false) {
                                list($db_name, $name) = explode('.', trim($name));
                            }
                    Severity: Major
                    Found in plugins/db/classes/db/yf_db_utils_mysql.class.php and 1 other location - About 4 hrs to fix
                    plugins/db/classes/db/yf_db_utils_driver.class.php on lines 1448..1466

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

                    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 trigger_exists($name, $extra = [], &$error = false)
                        {
                            if (strpos($name, '.') !== false) {
                                list($db_name, $name) = explode('.', trim($name));
                            }
                    Severity: Major
                    Found in plugins/db/classes/db/yf_db_utils_driver.class.php and 1 other location - About 4 hrs to fix
                    plugins/db/classes/db/yf_db_utils_mysql.class.php on lines 325..343

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

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

                        public function csv_ecommpay($options = null)
                        {
                            $operation_id = &$_POST['operation_id'];
                            if ( ! is_array($operation_id) || count($operation_id) < 1) {
                                common()->message_info('Отсутствуют данные');
                    Severity: Major
                    Found in plugins/payment/admin_modules/yf_manage_payout.class.php - About 4 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language