Showing 4,217 of 4,217 total issues

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

    public function test_elseforeach()
    {
        $data = ['k1' => 'v1', 'k2' => 'v2'];
        $this->assertEquals('no rows', self::_tpl('{foreach(data)} {_key}={_val} {elseforeach}no rows{/foreach}', []));
        $this->assertEquals(' k1=v1  k2=v2 ', self::_tpl('{foreach(data)} {_key}={_val} {elseforeach}no rows{/foreach}', ['data' => $data]));
Severity: Major
Found in .dev/tests/unit/tpl/tpl_driver_yf_foreach_test.Test.php and 1 other location - About 4 hrs to fix
.dev/tests/unit/tpl/tpl_driver_yf_core_test.Test.php on lines 577..586

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

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

    private function _globals_write()
    {
        // GLOBALS write
        $msg = 'GLOBALS: write';
        $start_ts = microtime(true);
Severity: Major
Found in .dev/samples/test_globals_vs_class.php and 1 other location - About 4 hrs to fix
.dev/samples/test_globals_vs_class.php on lines 277..292

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

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

    private function _class_wrap_write()
    {
        // Class write
        $msg = 'CLASS  : write';
        $start_ts = microtime(true);
Severity: Major
Found in .dev/samples/test_globals_vs_class.php and 1 other location - About 4 hrs to fix
.dev/samples/test_globals_vs_class.php on lines 140..155

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

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

    public function get_asset_from_bower($name, $version = 'master', $asset_data = [], $asset_type)
    {
        if ( ! $name || ! $asset_data || ! isset($asset_data[$asset_type])) {
            return false;
        }
Severity: Minor
Found in plugins/assets/classes/yf_assets.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 search_used has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    public function search_used()
    {
        $exclude_paths = [
            '*/.git/*',
            '*/.dev/*',
Severity: Minor
Found in plugins/assets/admin_modules/yf_manage_assets.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 _show_block has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    public function _show_block($input = [])
    {
        if ( ! isset($this->_blocks_infos)) {
            $this->_blocks_infos = main()->get_data('blocks_all');
        }
Severity: Minor
Found in plugins/sys/classes/yf_core_blocks.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 _db_change_if_ok has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    public function _db_change_if_ok($table, $fields, $type, $extra = [])
    {
        $func = function ($table, $fields, $type, $extra, $form) {
            if ( ! $table || ! $type || empty($_POST)) {
                return $form;
Severity: Minor
Found in plugins/form2/classes/yf_form2.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 _get_update_batch_sql has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    public function _get_update_batch_sql($table, $values, $index)
    {
        $ids = [];
        $final = [];
        $where = [];
Severity: Minor
Found in plugins/db/classes/db/yf_db_query_builder_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 _parse has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    public function _parse($host, $url, $query, $url_str, $class_rewrite)
    {
        $s = '';
        if (false !== strpos($url[0], '%')) {
            $url[0] = urldecode($url[0]);
Severity: Minor
Found in plugins/rewrite/classes/rewrite/yf_rewrite_pattern_yf.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 _check_ip has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    public function _check_ip($ip, $ignore_ips = '', $check_type = 'force')
    {
        $masks = [
            '0.0.0.0/8',        // Current network (only valid as source address)    RFC 1700
            '10.0.0.0/8',        // Private network    RFC 1918
Severity: Minor
Found in plugins/common/classes/common/yf_client_utils.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 _try_to_find has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    public function _try_to_find($input_name = '', $CUR_CHECKS = [], $where_search = '')
    {
        // Default value
        $IS_FOUND = false;
        $WHAT_FOUND = '';
Severity: Minor
Found in plugins/common/classes/common/yf_user_ban.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 _is_spider has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    public function _is_spider($ip = '', $ua = '')
    {
        $CHECK_IP = false;
        $CHECK_UA = false;
        if ($ip && preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $ip)) {
Severity: Minor
Found in plugins/common/classes/common/yf_spider_detection.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 go has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    public function go($new_file_path, $name_in_form = 'image', $max_image_size = 0, $is_local = false)
    {
        // We do not want to user break our operation
        ignore_user_abort(true);
        // New name is required
Severity: Minor
Found in plugins/common/classes/common/yf_upload_image.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 _get_items_array has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    public function _get_items_array($cat_name = '', $recursive_sort = true, $all = false)
    {
        if (empty($cat_name)) {
            $cat_name = $this->_default_cats_block;
        }
Severity: Minor
Found in plugins/categories/classes/yf_cats.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

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

<?php

/**
 * Database structure installer core.
 */
Severity: Minor
Found in plugins/db/classes/db/yf_db_installer.class.php - About 4 hrs to fix

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

        public function _show_filter()
        {
            $object = &$this->object;
            $action = &$this->action;
            $filter_name = &$this->filter_name;
    Severity: Major
    Found in plugins/payment/admin_modules/yf_manage_transfer.class.php and 4 other locations - About 4 hrs to fix
    plugins/payment/admin_modules/yf_manage_currency.class.php on lines 96..126
    plugins/payment/admin_modules/yf_manage_deposit.class.php on lines 176..206
    plugins/payment/admin_modules/yf_manage_payment_operation.class.php on lines 142..172
    plugins/payment/admin_modules/yf_manage_payout.class.php on lines 228..258

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

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

    #!/usr/bin/env php
    <?php
    
    require_once dirname(__DIR__) . '/scripts_init.php';
    
    
    Severity: Major
    Found in .dev/scripts/google_webfonts/google_fonts_into_db.php and 2 other locations - About 4 hrs to fix
    .dev/scripts/currencies/currencies_into_db.php on lines 1..20
    .dev/scripts/languages/languages_into_db.php on lines 1..19

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

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

        public function _show_filter()
        {
            $object = &$this->object;
            $action = &$this->action;
            $filter_name = &$this->filter_name;
    Severity: Major
    Found in plugins/payment/admin_modules/yf_manage_currency.class.php and 4 other locations - About 4 hrs to fix
    plugins/payment/admin_modules/yf_manage_deposit.class.php on lines 176..206
    plugins/payment/admin_modules/yf_manage_payment_operation.class.php on lines 142..172
    plugins/payment/admin_modules/yf_manage_payout.class.php on lines 228..258
    plugins/payment/admin_modules/yf_manage_transfer.class.php on lines 167..197

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

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

    #!/usr/bin/env php
    <?php
    
    require_once dirname(__DIR__) . '/scripts_init.php';
    
    
    Severity: Major
    Found in .dev/scripts/currencies/currencies_into_db.php and 2 other locations - About 4 hrs to fix
    .dev/scripts/google_webfonts/google_fonts_into_db.php on lines 1..21
    .dev/scripts/languages/languages_into_db.php on lines 1..19

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

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

        public function _show_filter()
        {
            $object = &$this->object;
            $action = &$this->action;
            $filter_name = &$this->filter_name;
    plugins/payment/admin_modules/yf_manage_currency.class.php on lines 96..126
    plugins/payment/admin_modules/yf_manage_deposit.class.php on lines 176..206
    plugins/payment/admin_modules/yf_manage_payout.class.php on lines 228..258
    plugins/payment/admin_modules/yf_manage_transfer.class.php on lines 167..197

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

    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