Function initialize_container
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
function initialize_container( $force = false ) {
if ( isset( $_GET['settings-updated'] ) || $force ) {
$ldp_container_init = get_option( 'ldp_container_init', false );
if ( $ldp_container_init || $force ) {
- 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 initialize_container
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
function initialize_container( $force = false ) {
if ( isset( $_GET['settings-updated'] ) || $force ) {
$ldp_container_init = get_option( 'ldp_container_init', false );
if ( $ldp_container_init || $force ) {
Method menu_setup
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function menu_setup() {
global $submenu;
// Removing all resources menu.
remove_submenu_page( 'edit.php?post_type=ldp_resource', 'edit.php?post_type=ldp_resource' );
$terms = get_terms(
Function menu_setup
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function menu_setup() {
global $submenu;
// Removing all resources menu.
remove_submenu_page( 'edit.php?post_type=ldp_resource', 'edit.php?post_type=ldp_resource' );
$terms = get_terms(
- 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 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
Visibility must be declared on method "initialize_container" Open
function initialize_container( $force = false ) {
- Exclude checks
Array double arrow not aligned correctly; expected 3 space(s) between "'label'" and double arrow, but found 1. Open
'label' => __( 'Organization', 'wpldp' ),
- 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
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space Open
$model = file_get_contents( __DIR__ . '/models/' . $term . '.json' );
- Exclude checks
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space Open
$updated_term = wp_update_term(
- Exclude checks
Array double arrow not aligned correctly; expected 8 space(s) between "'slug'" and double arrow, but found 1. Open
'slug' => $term,
- Exclude checks
Array double arrow not aligned correctly; expected 8 space(s) between "'slug'" and double arrow, but found 1. Open
'slug' => $term,
- Exclude checks
A gettext call containing placeholders was found, but was not accompanied by a "translators:" comment on the line above to clarify the meaning of the placeholders. Open
__(
- Exclude checks
Array double arrow not aligned correctly; expected 3 space(s) between "'label'" and double arrow, but found 1. Open
'label' => __( 'Document', 'wpldp' ),
- Exclude checks
Processing form data without nonce verification. Open
if ( ( isset( $_GET['settings-updated'] ) && 'true' === $_GET['settings-updated'] ) ) {
- Exclude checks
Array double arrow not aligned correctly; expected 8 space(s) between "'person'" and double arrow, but found 1. Open
'person' => array(
- Exclude checks
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found 'get_option'. Open
echo "<input type='text' size='150' name='ldp_context' value='" . get_option( 'ldp_context', 'http://lov.okfn.org/dataset/lov/context' ) . "' />";
- Exclude checks
Visibility must be declared on method "menu_setup" Open
function menu_setup() {
- Exclude checks
Visibility must be declared on method "backend_hooking" Open
function backend_hooking() {
- Exclude checks
Visibility must be declared on method "ldp_container_init_field" Open
function ldp_container_init_field() {
- Exclude checks
Array double arrow not aligned correctly; expected 8 space(s) between "'thesis'" and double arrow, but found 1. Open
'thesis' => array(
- Exclude checks
Processing form data without nonce verification. Open
if ( isset( $_GET['settings-updated'] ) || $force ) {
- Exclude checks
Array double arrow not aligned correctly; expected 3 space(s) between "'label'" and double arrow, but found 1. Open
'label' => __( 'Initiative', 'wpldp' ),
- Exclude checks
Processing form data without nonce verification. Open
if ( ( isset( $_GET['settings-updated'] ) && 'true' === $_GET['settings-updated'] ) ) {
- Exclude checks
Visibility must be declared on method "wpldp_options_page" Open
function wpldp_options_page() {
- Exclude checks
Array double arrow not aligned correctly; expected 2 space(s) between "'organization'" and double arrow, but found 1. Open
'organization' => array(
- Exclude checks
A gettext call containing placeholders was found, but was not accompanied by a "translators:" comment on the line above to clarify the meaning of the placeholders. Open
__(
- Exclude checks
Array double arrow not aligned correctly; expected 3 space(s) between "'label'" and double arrow, but found 1. Open
'label' => __( 'Place', 'wpldp' ),
- Exclude checks
Array double arrow not aligned correctly; expected 9 space(s) between "'theme'" and double arrow, but found 1. Open
'theme' => array(
- Exclude checks
Processing form data without nonce verification. Open
if ( 'options-general.php' === $pagenow && 'wpldp' === $_GET['page'] ) { // change my-plugin to your plugin page.
- Exclude checks
Array double arrow not aligned correctly; expected 4 space(s) between "'initiative'" and double arrow, but found 1. Open
'initiative' => array(
- Exclude checks
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space Open
$term_meta['ldp_model'] = stripslashes_deep( $model );
- Exclude checks
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '__'. Open
echo '<h2>' . __( 'WP-LDP Settings', 'wpldp' ) . '</h2>';
- Exclude checks
Array double arrow not aligned correctly; expected 9 space(s) between "'group'" and double arrow, but found 1. Open
'group' => array(
- Exclude checks
Array double arrow not aligned correctly; expected 6 space(s) between "'document'" and double arrow, but found 1. Open
'document' => array(
- Exclude checks
Array double arrow not aligned correctly; expected 3 space(s) between "'label'" and double arrow, but found 1. Open
'label' => __( 'Theme', 'wpldp' ),
- Exclude checks
Visibility must be declared on method "ldp_menu" Open
function ldp_menu() {
- Exclude checks
Array double arrow not aligned correctly; expected 3 space(s) between "'label'" and double arrow, but found 1. Open
'label' => __( 'Group', 'wpldp' ),
- Exclude checks
Array double arrow not aligned correctly; expected 7 space(s) between "'artwork'" and double arrow, but found 1. Open
'artwork' => array(
- Exclude checks
Array double arrow not aligned correctly; expected 3 space(s) between "'label'" and double arrow, but found 1. Open
'label' => __( 'Event', 'wpldp' ),
- Exclude checks
Array double arrow not aligned correctly; expected 6 space(s) between "'order'" and double arrow, but found 1. Open
'order' => 'DESC'
- Exclude checks
Each array item in a multi-line array declaration must end in a comma Open
'order' => 'DESC'
- Exclude checks
Array double arrow not aligned correctly; expected 9 space(s) between "'event'" and double arrow, but found 1. Open
'event' => array(
- Exclude checks
Each array item in a multi-line array declaration must end in a comma Open
)
- Exclude checks
Visibility must be declared on method "ldp_context_field" Open
function ldp_context_field() {
- Exclude checks
Array double arrow not aligned correctly; expected 3 space(s) between "'label'" and double arrow, but found 1. Open
'label' => __( 'Good or Service', 'wpldp' ),
- Exclude checks
Array double arrow not aligned correctly; expected 9 space(s) between "'place'" and double arrow, but found 1. Open
'place' => array(
- Exclude checks
Array double arrow not aligned correctly; expected 3 space(s) between "'label'" and double arrow, but found 1. Open
'label' => __( 'Thesis', 'wpldp' ),
- Exclude checks
Array double arrow not aligned correctly; expected 3 space(s) between "'label'" and double arrow, but found 1. Open
'label' => __( 'Artwork', 'wpldp' ),
- Exclude checks
file_get_contents() is discouraged. Use wp_remote_get() for remote URLs instead. Open
$model = file_get_contents( __DIR__ . '/models/' . $term . '.json' );
- Exclude checks
Array double arrow not aligned correctly; expected 3 space(s) between "'label'" and double arrow, but found 1. Open
'label' => __( 'Person', 'wpldp' ),
- Exclude checks
Detected usage of a non-validated input variable: $_GET Open
if ( 'options-general.php' === $pagenow && 'wpldp' === $_GET['page'] ) { // change my-plugin to your plugin page.
- Exclude checks
Visibility must be declared on method "wpldp_validation_notice" Open
function wpldp_validation_notice() {
- Exclude checks
A gettext call containing placeholders was found, but was not accompanied by a "translators:" comment on the line above to clarify the meaning of the placeholders. Open
__( 'List of all resources of type %1$s', 'wpldp' ),
- Exclude checks
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '__'. Open
echo __( 'The generals settings of the WP-LDP plugin.', 'wpldp' );
- Exclude checks