Showing 4,217 of 4,217 total issues

Function _delete has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    public function _delete($params = [])
    {
        if (empty(main()->USER_ID) && MAIN_TYPE_USER) {
            return _error_need_login();
        }
Severity: Minor
Found in plugins/comments/modules/comments/yf_comments_manage.class.php - About 3 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 remote_file_size has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    public function remote_file_size($url = '')
    {
        $url = $this->_fix_url($url);
        $tmp = @parse_url($url);
        $sch = $tmp['scheme'];
Severity: Minor
Found in plugins/common/classes/common/yf_remote_files.class.php - About 3 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_set has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    public function multi_set($data = [], $ttl = 0)
    {
        $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 3 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 26 (exceeds 5 allowed). Consider refactoring.
Open

    public function connect()
    {
        $this->db_connect_id = mysqli_init();
        if ( ! $this->db_connect_id || mysqli_connect_errno()) {
            $this->_connect_error = 'cannot_connect_to_server';
Severity: Minor
Found in plugins/db/classes/db/yf_db_driver_mysqli.class.php - About 3 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 del_by_prefix has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    public function del_by_prefix($prefix = '')
    {
        $do_real_work = true;
        if ( ! $this->_driver_ok) {
            $do_real_work = false;
Severity: Minor
Found in plugins/cache/classes/yf_cache.class.php - About 3 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 _show_info_items has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    public function _show_info_items()
    {
        // Array of text fields
        $text_fields = [
            'name' => 'Name',
Severity: Minor
Found in plugins/user/modules/yf_user_profile.class.php - About 3 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 products_show has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    public function products_show($search = '', $str_search = '')
    {
        foreach ((array) module('shop')->_shop_cats as $_cat_id => $_cat_name) {
            if ($_GET['id'] == module('shop')->_shop_cats_all[$_cat_id]['url'] && $_GET['id'] != '') {
                $_GET['id'] = $_cat_id;
Severity: Minor
Found in plugins/shop/modules/shop/yf_shop_products_show.class.php - About 3 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 attribute_edit has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    public function attribute_edit()
    {
        if (empty($_GET['id'])) {
            return _e('no 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 _show_auto_table has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    public function _show_auto_table($items = [], $params = [], $name = '')
    {
        if ( ! is_array($items)) {
            $items = [];
        }
Severity: Minor
Found in classes/yf_debug.class.php - About 3 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

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

            'maestro' => [
                'title' => 'Maestro',
                'icon' => 'maestro',
                'currency' => [
                    'RUB' => [
plugins/payment/classes/yf_payment_api__provider_payeer.class.php on lines 336..376
plugins/payment/classes/yf_payment_api__provider_payeer.class.php on lines 378..418
plugins/payment/classes/yf_payment_api__provider_payeer.class.php on lines 508..548
plugins/payment/classes/yf_payment_api__provider_payeer.class.php on lines 595..635

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

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

            'bitcoin' => [
                'title' => 'Bitcoin',
                'icon' => 'bitcoin',
                'currency' => [
                    'BTC' => [
plugins/payment/classes/yf_payment_api__provider_payeer.class.php on lines 336..376
plugins/payment/classes/yf_payment_api__provider_payeer.class.php on lines 378..418
plugins/payment/classes/yf_payment_api__provider_payeer.class.php on lines 420..460
plugins/payment/classes/yf_payment_api__provider_payeer.class.php on lines 508..548

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

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

            'visa' => [
                'title' => 'Visa',
                'icon' => 'visa',
                'currency' => [
                    'USD' => [
plugins/payment/classes/yf_payment_api__provider_payeer.class.php on lines 378..418
plugins/payment/classes/yf_payment_api__provider_payeer.class.php on lines 420..460
plugins/payment/classes/yf_payment_api__provider_payeer.class.php on lines 508..548
plugins/payment/classes/yf_payment_api__provider_payeer.class.php on lines 595..635

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

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

            'paxum' => [
                'title' => 'Paxum',
                'icon' => 'paxum',
                'currency' => [
                    'USD' => [
plugins/payment/classes/yf_payment_api__provider_payeer.class.php on lines 336..376
plugins/payment/classes/yf_payment_api__provider_payeer.class.php on lines 378..418
plugins/payment/classes/yf_payment_api__provider_payeer.class.php on lines 420..460
plugins/payment/classes/yf_payment_api__provider_payeer.class.php on lines 595..635

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

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

            'mastercard' => [
                'title' => 'Mastercard',
                'icon' => 'mastercard',
                'currency' => [
                    'RUB' => [
plugins/payment/classes/yf_payment_api__provider_payeer.class.php on lines 336..376
plugins/payment/classes/yf_payment_api__provider_payeer.class.php on lines 420..460
plugins/payment/classes/yf_payment_api__provider_payeer.class.php on lines 508..548
plugins/payment/classes/yf_payment_api__provider_payeer.class.php on lines 595..635

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

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_js()
    {
        _class('assets')->clean_all();
        $jquery_url = _class('assets')->get_asset('jquery', 'js');
        $this->assertNotEmpty($jquery_url);
Severity: Major
Found in .dev/tests/unit/tpl/tpl_driver_yf_core_test.Test.php and 1 other location - About 3 hrs to fix
.dev/tests/unit/tpl/tpl_driver_yf_core_test.Test.php on lines 362..371

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

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_css()
    {
        _class('assets')->clean_all();
        $jqueryui_url = _class('assets')->get_asset('jquery-ui', 'css');
        $this->assertNotEmpty($jqueryui_url);
Severity: Major
Found in .dev/tests/unit/tpl/tpl_driver_yf_core_test.Test.php and 1 other location - About 3 hrs to fix
.dev/tests/unit/tpl/tpl_driver_yf_core_test.Test.php on lines 328..337

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

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

    public function product_clone()
    {
        $_GET['id'] = (int) ($_GET['id']);
        if ($_GET['id']) {
            $a = $this->_get_product($_GET['id']);

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

    <?php
    
    /**
     * Dashboards2 management.
     *
    Severity: Minor
    Found in plugins/dashboards/admin_modules/yf_manage_dashboards2.class.php - About 3 hrs to fix

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

          public function _get_modules($params = [])
          {
              // Need to prevent multiple calls
              if (isset($this->_admin_modules_array)) {
                  return $this->_admin_modules_array;
      plugins/sys/classes/core_api/yf_core_api_user_modules.class.php on lines 21..37

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

      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

              return table('SELECT * FROM ' . db('shop_product_images_revisions'), [
                      'filter' => $_SESSION[$_GET['object'] . '__product_images_revisions'],
                      'filter_params' => [
                          'action' => ['eq', 'action'],
                          'user_id' => ['eq', 'user_id'],
      plugins/shop/admin_modules/manage_shop/yf_manage_shop__product_revisions.class.php on lines 549..562

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

      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