Showing 4,217 of 4,217 total issues

Function go has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function go($new_file_path, $name_in_form = 'archive')
    {
        ignore_user_abort(true);
        if (empty($new_file_path)) {
            trigger_error(__CLASS__ . ': New file path id required', E_USER_WARNING);
Severity: Minor
Found in plugins/common/classes/common/yf_upload_archive.class.php - About 1 hr 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 crop has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function crop($source_file_path, $dest_file_path, $LIMIT_X, $LIMIT_Y, $pos_left, $pos_top)
    {
        // Check source file
        if ( ! file_exists($source_file_path) || ! filesize($source_file_path) || ! is_readable($source_file_path)) {
            trigger_error('CROP_IMG: Source file is empty', E_USER_WARNING);
Severity: Minor
Found in plugins/common/classes/common/yf_image_manip.class.php - About 1 hr 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_search_engine_url has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function is_search_engine_url($url = '')
    {
        $url = trim($url);
        if ( ! strlen($url)) {
            return false;
Severity: Minor
Found in plugins/common/classes/common/yf_spider_detection.class.php - About 1 hr 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 _prepare_invoice_body has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function _prepare_invoice_body($order_id = false)
    {
        $_class_price = $this->_class_price;
        $_class_units = $this->_class_units;
        $_class_region = $this->_class_region;

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

    public function _show_filter()
    {
        if ( ! in_array($_GET['action'], $this->_avail_filters)) {
            return false;
        }

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

    public function delete()
    {
        $user_id = (int) ($_GET['id']);
        if ( ! $user_id) {
            return false;
Severity: Minor
Found in plugins/user/admin_modules/yf_manage_users.class.php - About 1 hr 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 _recursive_get_children_ids has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function _recursive_get_children_ids($cat_id = 0, $cat_items = [], $get_sub_children = true, $return_array = false)
    {
        $children_ids = [];
        if (empty($cat_id)) {
            return $children_ids;
Severity: Minor
Found in plugins/categories/classes/yf_cats.class.php - About 1 hr 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 _recursive_get_parents_ids has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function _recursive_get_parents_ids($cat_id = 0, $cat_items = [])
    {
        $parents_ids = [];
        if (empty($cat_id)) {
            return $parents_ids;
Severity: Minor
Found in plugins/categories/classes/yf_cats.class.php - About 1 hr 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 confirm has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function confirm()
    {
        // Send registration confirmation email
        if ( ! $this->CONFIRM_REGISTER) {
            return tpl()->parse('@object/confirm_messages', ['msg' => 'confirm_not_needed']);
Severity: Minor
Found in plugins/user/modules/yf_register.class.php - About 1 hr 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 _order_step_select_payment has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function _order_step_select_payment($FORCE_DISPLAY_FORM = false)
    {
        // Show previous form if needed
        if (common()->_error_exists() || empty($_POST)) {
            return module('shop')->_order_step_delivery();

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

    public function asset($type = '')
    {
        session_write_close();
        no_graphics(true);
        $name = strtolower(preg_replace('~[^a-z0-9_-]+~ims', '', trim($_GET['id'])));
Severity: Minor
Found in plugins/dynamic/modules/dynamic/yf_dynamic_assets.class.php - About 1 hr 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 product_details has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function product_details()
    {
        if ( ! $_GET['id']) {
            return is_redirect('./?object=shop');
        }
Severity: Minor
Found in plugins/shop/modules/shop/yf_shop_product_details.class.php - About 1 hr 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 has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function search($start_dirs, $pattern_include = '', $pattern_exclude = '', $pattern_find)
    {
        if ( ! is_array($start_dirs)) {
            $start_dirs = [$start_dirs];
        }
Severity: Minor
Found in classes/yf_dir.class.php - About 1 hr 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 _force_close_bb_codes has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function _force_close_bb_codes($text = '')
    {
        $this->_preload_data();
        $add_text = '';
        $opened_codes = $closed_codes = [];
Severity: Minor
Found in plugins/content/classes/yf_bb_codes.class.php - About 1 hr 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 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function _connect()
    {
        if (isset($this->sphinx_connection)) {
            return $this->sphinx_connection;
        }
Severity: Minor
Found in plugins/search/classes/yf_sphinxsearch.class.php - About 1 hr 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 _attrs_string2array has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    function _attrs_string2array($string = '', $strip_quotes = true)
    {
        $output_array = [];
        if ( ! is_string($string)) {
            return [];
Severity: Minor
Found in functions/yf_common_funcs.php - About 1 hr 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

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

    public function _url($name, $replace = null)
    {
        $url = &$this->url;
        $result = null;
        if (empty($url[$name])) {
Severity: Major
Found in plugins/payment/admin_modules/yf_manage_deposit.class.php and 4 other locations - About 1 hr to fix
plugins/payment/admin_modules/yf_manage_payment_operation.class.php on lines 64..76
plugins/payment/admin_modules/yf_manage_payment_yandexmoney.class.php on lines 62..74
plugins/payment/admin_modules/yf_manage_payout.class.php on lines 140..152
plugins/payment/admin_modules/yf_manage_transfer.class.php on lines 110..122

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

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

        return form($r, [
                'selected' => $_SESSION[$filter_name],
                'class' => 'form-vertical',
            ])
            ->text('name')
Severity: Major
Found in plugins/geo/admin_modules/yf_manage_regions.class.php and 1 other location - About 1 hr to fix
plugins/geo/admin_modules/yf_manage_countries.class.php on lines 108..116

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

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 _url($name, $replace = null)
    {
        $url = &$this->url;
        $result = null;
        if (empty($url[$name])) {
plugins/payment/admin_modules/yf_manage_deposit.class.php on lines 88..100
plugins/payment/admin_modules/yf_manage_payment_operation.class.php on lines 64..76
plugins/payment/admin_modules/yf_manage_payout.class.php on lines 140..152
plugins/payment/admin_modules/yf_manage_transfer.class.php on lines 110..122

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

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

        } else {
            $table = table('SELECT * FROM ' . db('notifications_receivers') . ' WHERE `notification_id`=' . (int) ($_GET['id']))
                ->text('receiver_id')
                ->text('is_read')
                ->date('add_date', ['format' => 'full', 'nowrap' => 1])
plugins/notifications/admin_modules/yf_manage_notifications.class.php on lines 104..111

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

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