WordPress/WordPress

View on GitHub

Showing 14,522 of 14,522 total issues

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

function get_single_template() {
    $object = get_queried_object();

    $templates = array();

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

function get_attachment_template() {
    $attachment = get_queried_object();

    $templates = array();

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

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

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

    public function _added( $lines, $encode = true ) {
        $r = '';
        foreach ( $lines as $line ) {
            if ( $encode ) {
                $processed_line = htmlspecialchars( $line );
Severity: Minor
Found in wp-includes/class-wp-text-diff-renderer-table.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_blogaddress_by_name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function get_blogaddress_by_name( $blogname ) {
    if ( is_subdomain_install() ) {
        if ( 'main' === $blogname ) {
            $blogname = 'www';
        }
Severity: Minor
Found in wp-includes/ms-blogs.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_user_option has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function get_user_option( $option, $user = 0, $deprecated = '' ) {
    global $wpdb;

    if ( ! empty( $deprecated ) ) {
        _deprecated_argument( __FUNCTION__, '3.0.0' );
Severity: Minor
Found in wp-includes/user.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 comment_form_title has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function comment_form_title( $no_reply_text = false, $reply_text = false, $link_to_parent = true, $post = null ) {
    global $comment;

    if ( false === $no_reply_text ) {
        $no_reply_text = __( 'Leave a Reply' );
Severity: Minor
Found in wp-includes/comment-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 count_many_users_posts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function count_many_users_posts( $users, $post_type = 'post', $public_only = false ) {
    global $wpdb;

    $count = array();
    if ( empty( $users ) || ! is_array( $users ) ) {
Severity: Minor
Found in wp-includes/user.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 validate_recovery_mode_key has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function validate_recovery_mode_key( $token, $key, $ttl ) {
        global $wp_hasher;

        $records = $this->get_keys();

Severity: Minor
Found in wp-includes/class-wp-recovery-mode-key-service.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 _context has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function _context( $lines, $encode = true ) {
        $r = '';
        foreach ( $lines as $line ) {
            if ( $encode ) {
                $processed_line = htmlspecialchars( $line );
Severity: Minor
Found in wp-includes/class-wp-text-diff-renderer-table.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 _deleted has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function _deleted( $lines, $encode = true ) {
        $r = '';
        foreach ( $lines as $line ) {
            if ( $encode ) {
                $processed_line = htmlspecialchars( $line );
Severity: Minor
Found in wp-includes/class-wp-text-diff-renderer-table.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 _sanitize_text_fields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function _sanitize_text_fields( $str, $keep_newlines = false ) {
    if ( is_object( $str ) || is_array( $str ) ) {
        return '';
    }

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

    public function render_media( $instance ) {
        $instance   = array_merge( wp_list_pluck( $this->get_instance_schema(), 'default' ), $instance );
        $attachment = null;

        if ( $this->is_attachment_with_mime_type( $instance['attachment_id'], $this->widget_options['mime_type'] ) ) {
Severity: Minor
Found in wp-includes/widgets/class-wp-widget-media-video.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 available_items_template has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function available_items_template() {
        ?>
        <div id="available-menu-items" class="accordion-container">
            <div class="customize-section-title">
                <button type="button" class="customize-section-back" tabindex="-1">
Severity: Minor
Found in wp-includes/class-wp-customize-nav-menus.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 paginate_comments_links has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function paginate_comments_links( $args = array() ) {
    global $wp_rewrite;

    if ( ! is_singular() ) {
        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 wp_trim_words has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function wp_trim_words( $text, $num_words = 55, $more = null ) {
    if ( null === $more ) {
        $more = __( '&hellip;' );
    }

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

function register_widget_control($name, $control_callback, $width = '', $height = '', ...$params) {
    _deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_widget_control()' );
    // Compat.
    if ( is_array( $name ) ) {
        if ( count( $name ) === 3 ) {
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 is_site_admin has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function is_site_admin( $user_login = '' ) {
    _deprecated_function( __FUNCTION__, '3.0.0', 'is_super_admin()' );

    if ( empty( $user_login ) ) {
        $user_id = get_current_user_id();
Severity: Minor
Found in wp-includes/ms-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 rest_find_any_matching_schema has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function rest_find_any_matching_schema( $value, $args, $param ) {
    $errors = array();

    foreach ( $args['anyOf'] as $index => $schema ) {
        if ( ! isset( $schema['type'] ) && isset( $args['type'] ) ) {
Severity: Minor
Found in wp-includes/rest-api.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 rest_validate_enum has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function rest_validate_enum( $value, $args, $param ) {
    $sanitized_value = rest_sanitize_value_from_schema( $value, $args, $param );
    if ( is_wp_error( $sanitized_value ) ) {
        return $sanitized_value;
    }
Severity: Minor
Found in wp-includes/rest-api.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