Showing 3,246 of 4,217 total issues

Function get_access_token has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_access_token()
    {
        $access_token = $this->_storage_get('access_token');
        if ($access_token) {
            return $access_token;
Severity: Minor
Found in plugins/oauth/classes/oauth/yf_oauth_driver2.class.php - About 25 mins 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_box has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function crop_box($source_file_path, $dest_file_path, $LIMIT_X, $LIMIT_Y)
    {
        $CROP_SIZE = $LIMIT_X;
        // Pre-check
        if ( ! file_exists($source_file_path)) {
Severity: Minor
Found in plugins/common/classes/common/yf_image_manip.class.php - About 25 mins 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 _unaccent_test3 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function _unaccent_test3($text = '')
    {
        static $search;
        if ( ! $search) {
            $search = [];
Severity: Minor
Found in plugins/common/classes/common/yf_utf8_clean.class.php - About 25 mins 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 checkout_images_revision has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function checkout_images_revision()
    {
        $_GET['id'] = (int) ($_GET['id']);
        $revision_data = db()->get('SELECT * FROM ' . db('shop_product_images_revisions') . ' WHERE id=' . $_GET['id']);
        if (empty($revision_data)) {

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

    public function _copy($id, $par)
    {
        $dir = $this->_path($id);
        $par = $this->_path($par);
        $new = explode('/', $dir);
Severity: Minor
Found in plugins/ckeditor/admin_modules/yf_ck_file_browser.class.php - About 25 mins 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 user_activate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function user_activate()
    {
        if ($_GET['id']) {
            $A = db()->query_fetch('SELECT * FROM ' . db('user') . ' WHERE id=' . (int) ($_GET['id']));
            if ($A['active'] == 1) {
Severity: Minor
Found in plugins/shop/admin_modules/manage_shop/yf_manage_shop_users.class.php - About 25 mins 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 conf has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function conf($opt = [])
    {
        ! $this->is_connection() && $this->reconnect();
        foreach ((array) $opt as $k => $v) {
            if ($this->driver == 'phpredis') {
Severity: Minor
Found in plugins/redis/classes/yf_wrapper_redis.class.php - About 25 mins 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 unit_edit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function unit_edit()
    {
        $_GET['id'] = (int) ($_GET['id']);
        if (empty($_GET['id'])) {
            return _e('Empty ID!');
Severity: Minor
Found in plugins/shop/admin_modules/manage_shop/yf_manage_shop_units.class.php - About 25 mins 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 lock has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function lock($resource, $ttl)
    {
        $this->init_instances();

        $token = uniqid();
Severity: Minor
Found in plugins/redis/classes/yf_wrapper_redlock.class.php - About 25 mins 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 factory has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function factory($options = [])
    {
        if ( ! $options || ! is_array($options)) {
            return  $this;
        }
Severity: Minor
Found in plugins/redis/classes/yf_wrapper_redis.class.php - About 25 mins 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 send_sms has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function send_sms()
    {
        if (main()->is_post()) {
            $phone = $_POST['phone'];
            $text = mb_substr($_POST['text'], 0, 512);
Severity: Minor
Found in plugins/shop/admin_modules/manage_shop/yf_manage_shop_send_sms.class.php - About 25 mins 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 _load_csv has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function _load_csv($file_name)
    {
        ini_set('auto_detect_line_endings', true);
        setlocale(LC_ALL, 'ru_RU.utf8')
            || setlocale(LC_ALL, 'ru_UA.utf8')

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

    public function checkout_group_revision()
    {
        $_GET['id'] = (int) ($_GET['id']);
        $db = db('shop_product_revisions');
        $ids = db()->get_one('SELECT data FROM ' . $db . ' WHERE item_id=' . $_GET['id'] . ' AND data IS NOT NULL ORDER BY id DESC');

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

    public function _count_levels($start_id = 0, &$children, $level = 0)
    {
        $ids = [];
        foreach ((array) $children[$start_id] as $id => $_tmp) {
            $ids[$id] = $level;
Severity: Minor
Found in plugins/categories/admin_modules/yf_category_editor.class.php - About 25 mins 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 _count_levels has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function _count_levels($start_id = 0, &$children, $level = 0)
    {
        $ids = [];
        foreach ((array) $children[$start_id] as $id => $_tmp) {
            $ids[$id] = $level;
Severity: Minor
Found in plugins/categories/classes/yf_cats.class.php - About 25 mins 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_select_attributes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function _get_select_attributes($atts = [])
    {
        if (empty($atts)) {
            return [];
        }
Severity: Minor
Found in plugins/shop/modules/shop/yf_shop__get_select_attributes.class.php - About 25 mins 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 _field_to_sql__manufacturer_name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function _field_to_sql__manufacturer_name($field, $value, $action = null)
    {
        if ($action == 'check') {
            return  [$field, $value];
        }

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

    public function _get_products_attributes($products_ids = [])
    {
        if (is_numeric($products_ids)) {
            $return_single_id = $products_ids;
            $products_ids = [$products_ids];

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

    protected function _api_upload_item()
    {
        $sub_action = $_GET['sub_action'];
        if ($this->is_post) {
            $post = json_decode(file_get_contents('php://input'), true);

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

    public function chart_bar($data, $params)
    {
        if ($params['flash'] == true) {
            return $this->chart_bar_flash($data, $params);
        }
Severity: Minor
Found in plugins/charts/classes/yf_charts.class.php - About 25 mins 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

Severity
Category
Status
Source
Language