Showing 4,217 of 4,217 total issues

Function category_revision_checkout has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function category_revision_checkout()
    {
        $type = 'category';
        $object = 'category_editor';
        $action = 'edit_item';

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

    public function product_clone()
    {
        $_GET['id'] = (int) ($_GET['id']);
        if ($_GET['id']) {
            $a = $this->_get_product($_GET['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 _order_view has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function _order_view()
    {
        if ($_POST['order_id']) {
            $_GET['id'] = (int) ($_POST['order_id']);
        } else {
Severity: Minor
Found in plugins/shop/modules/shop/yf_shop_order_view.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 _get_nav_by_item_id has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function _get_nav_by_item_id($item_id = 0, $cat_items = [], $STPL_NAME = '', $prepare_link_callback = null)
    {
        if (empty($STPL_NAME)) {
            $STPL_NAME = __CLASS__ . '/nav_item';
        }
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 _attributes_save has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function _attributes_save($object_id = 0)
    {
        if (empty($object_id)) {
            return;
        }

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

    public function _order_step_finish($FORCE_DISPLAY_FORM = false)
    {
        module('shop')->_basket_api()->clean();

        if (isset($_GET['page'])) {
Severity: Minor
Found in plugins/shop/modules/shop/yf_shop__order_step_finish.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 _format_db_explain_result has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function _format_db_explain_result($explain_result = [])
    {
        if (empty($explain_result)) {
            return false;
        }
Severity: Minor
Found in plugins/logs/classes/logs/yf_logs_db_queries.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 _searchd_running has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function _searchd_running()
    {
        $pid_path = $this->LOG_PATH . 'searchd.pid';

        if (file_exists($pid_path)) {
Severity: Minor
Found in plugins/search/admin_modules/yf_manage_sphinx.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 _format_date has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function _format_date($input_date = '', $type = 'short')
    {
        if ( ! strlen($input_date)) {
            return '';
        }
Severity: Minor
Found in classes/yf_utils.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 _validate_rules_array_from_raw has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function _validate_rules_array_from_raw($raw = '')
    {
        $rules = [];
        // esxape '|' to '\|'
        $delimeter = '|';
Severity: Minor
Found in classes/yf_validate.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 _get_lib_path has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    function _get_lib_path($name, $params = []) {
        if (isset($this->php_libs[$name])) {
            return $this->php_libs[$name];
        }
        if (!isset($this->_paths_cache)) {
Severity: Minor
Found in services/_yf_autoloader.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 _check_location has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function _check_location($cur_country = '', $cur_region = '', $cur_city = '')
    {
        // TODO: rewrite me
        if (FEATURED_COUNTRY_SELECT && ! empty($_POST['country']) && substr($_POST['country'], 0, 2) == 'f_') {
            $_POST['country'] = substr($_POST['country'], 2);
Severity: Minor
Found in classes/yf_validate.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 get_yf_console_commands has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

function get_yf_console_commands()
{
    $cmds = [];
    $subfolder = 'commands/';
    $prefix_project = 'console_';
Severity: Minor
Found in .dev/console/yf.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 html_table_to_array has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    function html_table_to_array($html)
    {
        if ( ! preg_match_all('~<tr[^>]*>(.*?)</tr>~ims', $html, $m)) {
            return [];
        }
Severity: Minor
Found in .dev/scripts/scripts_utils.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 _fix_sql_php has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function _fix_sql_php($sql_php)
    {
        $innodb_has_fulltext = self::_innodb_has_fulltext();
        if ( ! $innodb_has_fulltext) {
            // Remove fulltext indexes from db structure before creating table

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

    public function _fix_sql_php($sql_php)
    {
        $innodb_has_fulltext = self::_innodb_has_fulltext();
        if ( ! $innodb_has_fulltext) {
            // Remove fulltext indexes from db structure before creating table
Severity: Minor
Found in .dev/tests/functional/model/class_model_sakila_test.Test.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 2 locations. Consider refactoring.
Open

    public function _create_api_response($options)
    {
        $url_options = [
            'account' => $this->ACCOUNT,
            'apiId' => $this->API_ID,
plugins/payment/classes/yf_payment_api__provider_payeer.class.php on lines 897..908

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

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

                if (strpos($file, $prefix_framework) === 0) {
                    $name = substr($file, strlen($prefix_framework), -strlen($ext));
                } elseif (strpos($file, $prefix_project) === 0) {
                    $name = substr($file, strlen($prefix_project), -strlen($ext));
                    $inside_project = true;
Severity: Major
Found in .dev/samples/classes/sample_console_tool.class.php and 1 other location - About 1 hr to fix
.dev/console/yf.php on lines 124..129

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

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

            if (strpos($file, $prefix_framework) === 0) {
                $name = substr($file, strlen($prefix_framework), -strlen($ext));
            } elseif (strpos($file, $prefix_project) === 0) {
                $name = substr($file, strlen($prefix_project), -strlen($ext));
                $inside_project = true;
Severity: Major
Found in .dev/console/yf.php and 1 other location - About 1 hr to fix
.dev/samples/classes/sample_console_tool.class.php on lines 64..69

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

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

    public function _create_api_response($options)
    {
        $url_options = [
            'account' => $this->ACCOUNT,
            'apiId' => $this->API_ID,
plugins/payment/classes/yf_payment_api__provider_bitpay.class.php on lines 405..416

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

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