WordPress/WordPress

View on GitHub

Showing 10,393 of 14,522 total issues

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

function network_home_url( $path = '', $scheme = null ) {
    if ( ! is_multisite() ) {
        return home_url( $path, $scheme );
    }

Severity: Minor
Found in wp-includes/link-template.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 wp_queue_comments_for_comment_meta_lazyload has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function wp_queue_comments_for_comment_meta_lazyload( $comments ) {
    _deprecated_function( __FUNCTION__, '6.3.0', 'wp_lazyload_comment_meta()' );
    // Don't use `wp_list_pluck()` to avoid by-reference manipulation.
    $comment_ids = array();
    if ( is_array( $comments ) ) {
Severity: Minor
Found in wp-includes/deprecated.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_author_feed_link has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function get_author_feed_link( $author_id, $feed = '' ) {
    $author_id           = (int) $author_id;
    $permalink_structure = get_option( 'permalink_structure' );

    if ( empty( $feed ) ) {
Severity: Minor
Found in wp-includes/link-template.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_posts_nav_link has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function get_posts_nav_link( $args = array() ) {
    global $wp_query;

    $return = '';

Severity: Minor
Found in wp-includes/link-template.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 _remove_theme_attribute_in_block_template_content has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function _remove_theme_attribute_in_block_template_content( $template_content ) {
    _deprecated_function(
        __FUNCTION__,
        '6.4.0',
        'traverse_and_serialize_blocks( parse_blocks( $template_content ), "_remove_theme_attribute_from_template_part_block" )'
Severity: Minor
Found in wp-includes/deprecated.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 wp_targeted_link_rel has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function wp_targeted_link_rel( $text ) {
    // Don't run (more expensive) regex if no links with targets.
    if ( stripos( $text, 'target' ) === false || stripos( $text, '<a ' ) === false || is_serialized( $text ) ) {
        return $text;
    }
Severity: Minor
Found in wp-includes/formatting.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_page_link has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function _get_page_link( $post = false, $leavename = false, $sample = false ) {
    global $wp_rewrite;

    $post = get_post( $post );

Severity: Minor
Found in wp-includes/link-template.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 has_content has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function has_content( $instance ) {
        if ( ! empty( $instance['ids'] ) ) {
            $attachments = wp_parse_id_list( $instance['ids'] );
            // Prime attachment post caches.
            _prime_post_caches( $attachments, false, false );
Severity: Minor
Found in wp-includes/widgets/class-wp-widget-media-gallery.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 test has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function test($capabilities = []) {
        if (!function_exists('fsockopen')) {
            return false;
        }

Severity: Minor
Found in wp-includes/Requests/src/Transport/Fsockopen.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 __construct has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct($url = null, $headers = [], $data = [], $options = []) {
        if ($url !== null && InputValidator::is_string_or_stringable($url) === false) {
            throw InvalidArgument::create(1, '$url', 'string|Stringable|null', gettype($url));
        }

Severity: Minor
Found in wp-includes/Requests/src/Session.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 test has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function test($capabilities = []) {
        if (!function_exists('curl_init') || !function_exists('curl_exec')) {
            return false;
        }

Severity: Minor
Found in wp-includes/Requests/src/Transport/Curl.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 wp_get_theme_data_template_parts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function wp_get_theme_data_template_parts() {
    $cache_group    = 'theme_json';
    $cache_key      = 'wp_get_theme_data_template_parts';
    $can_use_cached = ! wp_is_development_mode( 'theme' );

Severity: Minor
Found in wp-includes/global-styles-and-settings.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 check_capabilities has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    final public function check_capabilities() {
        if ( ! empty( $this->capability ) && ! current_user_can( $this->capability ) ) {
            return false;
        }
        foreach ( $this->settings as $setting_id ) {
Severity: Minor
Found in wp-includes/customize/class-wp-customize-partial.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 render_content has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function render_content() {
        if ( empty( $this->choices ) ) {
            return;
        }

Severity: Minor
Found in wp-includes/customize/class-wp-customize-nav-menu-location-control.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 match_domain has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function match_domain($host, $reference) {
        if (InputValidator::is_string_or_stringable($host) === false) {
            throw InvalidArgument::create(1, '$host', 'string|Stringable', gettype($host));
        }

Severity: Minor
Found in wp-includes/Requests/src/Ssl.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_comment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function get_comment( $id ) {
        $error = new WP_Error(
            'rest_comment_invalid_id',
            __( 'Invalid comment ID.' ),
            array( 'status' => 404 )
Severity: Minor
Found in wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.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_item_permissions_check has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_item_permissions_check( $request ) {

        $tax_obj = get_taxonomy( $request['taxonomy'] );

        if ( $tax_obj ) {
Severity: Minor
Found in wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.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 metadata_exists has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function metadata_exists( $meta_type, $object_id, $meta_key ) {
    if ( ! $meta_type || ! is_numeric( $object_id ) ) {
        return false;
    }

Severity: Minor
Found in wp-includes/meta.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 normalize_query_param has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function normalize_query_param( $query_param ) {
        $prefix = 'comment_';

        switch ( $query_param ) {
            case 'id':
Severity: Minor
Found in wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.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 parse_url_details has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function parse_url_details( $request ) {
        $url = untrailingslashit( $request['url'] );

        if ( empty( $url ) ) {
            return new WP_Error( 'rest_invalid_url', __( 'Invalid URL' ), array( 'status' => 404 ) );
Severity: Minor
Found in wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.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