Showing 378 of 379 total issues
Function wpldp_validation_notice
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function wpldp_validation_notice() {
global $pagenow;
if ( 'options-general.php' === $pagenow && 'wpldp' === $_GET['page'] ) { // change my-plugin to your plugin page.
if ( ( isset( $_GET['settings-updated'] ) && 'true' === $_GET['settings-updated'] ) ) {
- Read upRead up
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
Method container_meta_box_callback
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function container_meta_box_callback( $post ) {
wp_nonce_field(
'wpldp_save_container_box_data',
'wpldp_container_box_nonce'
);
Function ldp_resource_post_link
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function ldp_resource_post_link( $post_link, $id = 0 ) {
$post = get_post( $id );
if ( Wpldp::RESOURCE_POST_TYPE === get_post_type( $post ) ) {
if ( is_object( $post ) ) {
- Read upRead up
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 save_custom_tax_field
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function save_custom_tax_field( $term_id ) {
$term_meta = get_option( "ldp_container_$term_id" );
if ( ! is_array( $term_meta ) ) {
$term_meta = array();
}
- Read upRead up
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
Avoid deeply nested control flow statements. Open
if ( empty( $term ) || ! is_array( $term ) ) {
$site_url_parsed = wp_parse_url( $site );
$term = wp_insert_term(
$site_url_parsed['host'] . ' ' . $site_url_parsed['path'],
'ldp_site'
Function render
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
this.render = function render( div, objectIri, template, context, modelName, prefix ) {
Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space Open
$term_meta = get_option( "ldp_container_$value->term_id" );
- Exclude checks
"require_once" is a statement not a function; no parentheses are required Open
require_once( 'class-utils.php' );
- Exclude checks
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$resource_uri'. Open
container: '<?php echo $resource_uri; ?>',
- Exclude checks
Array double arrow not aligned correctly; expected 6 space(s) between "'show_in_menu'" and double arrow, but found 10. Open
'show_in_menu' => true,
- Exclude checks
In footer ($in_footer) is not set explicitly wp_register_script; It is recommended to load scripts in the footer. Please set this value to true
to load it in the footer, or explicitly false
if it should be loaded in the header. Open
wp_register_script(
- Exclude checks
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$ldp_model'. Open
models: <?php echo $ldp_model; ?>
- Exclude checks
Resource version not set in call to wp_register_script(). This means new versions of the script will not always be loaded due to browser caching. Open
wp_register_script(
- Exclude checks
Found precision alignment of 2 spaces. Open
strpos( $site, 'https://' ) !== false )
- Exclude checks
Overriding WordPress globals is prohibited. Found assignment to $submenu Open
$submenu['edit.php?post_type=ldp_resource'][ 10 - $i ] = $submenu_item_value;
- Exclude checks
Visibility must be declared on method "wpldp_plugin_update" Open
function wpldp_plugin_update() {
- Exclude checks
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '__'. Open
echo "<th scope='row'><label for='ldp_site_url'>" . __( 'web site', 'wpldp' ). '</label></th>';
- Exclude checks
Resource version not set in call to wp_register_script(). This means new versions of the script will not always be loaded due to browser caching. Open
wp_register_script(
- Exclude checks
Using cURL functions is highly discouraged. Use wp_remote_get() instead. Open
curl_setopt( $ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/ld+json', 'Accept: application/ld+json' ) );
- Exclude checks
Array double arrow not aligned correctly; expected 29 space(s) between "'@type'" and double arrow, but found 4. Open
'@type' => 'http://www.w3.org/ns/ldp#BasicContainer',
- Exclude checks