Showing 16 of 16 total issues
Function gtm_multisite_admin_change_tag
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
Open
public function gtm_multisite_admin_change_tag() {
header( 'Content-type: application/json' );
if ( check_ajax_referer( 'gtm_multisite_admin_security', 'security', false ) ) {
$site_id = filter_var( $_POST['site_id'], FILTER_VALIDATE_INT, array( 'default' => 0 ) );
$gtm_tag = filter_var( $_POST['gtm_tag'], FILTER_SANITIZE_STRING, array( 'default' => 'Add ID' ) );
- 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 gtm_multisite_admin_change_tag
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function gtm_multisite_admin_change_tag() {
header( 'Content-type: application/json' );
if ( check_ajax_referer( 'gtm_multisite_admin_security', 'security', false ) ) {
$site_id = filter_var( $_POST['site_id'], FILTER_VALIDATE_INT, array( 'default' => 0 ) );
$gtm_tag = filter_var( $_POST['gtm_tag'], FILTER_SANITIZE_STRING, array( 'default' => 'Add ID' ) );
Function error
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
, error: function(e, x, settings, exception) {
// Generic debugging
var errorMessage;
var statusErrorMap = {
'400' : "Server understood request but request content was invalid.",
Method manage_columns
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function manage_columns( $column_name, $site_id ) {
if ( 'gtm-tag' == $column_name ) {
echo '<div class="gtm-multisite">';
//delete_blog_option( $site_id, 'gtm4wp-options');
Function manage_columns
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
public function manage_columns( $column_name, $site_id ) {
if ( 'gtm-tag' == $column_name ) {
echo '<div class="gtm-multisite">';
//delete_blog_option( $site_id, 'gtm4wp-options');
- 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
Class file names should be based on the class name with "class-" prepended. Expected class-gtm-multisite-admin.php, but found gtm-multisite-admin.php. Open
Open
<?php
- Exclude checks
Equals sign not aligned with surrounding assignments; expected 1 space but found 3 spaces Open
Open
$site_id = filter_var( $_POST['site_id'], FILTER_VALIDATE_INT, array( 'default' => 0 ) );
- Exclude checks
Array double arrow not aligned correctly; expected 3 space(s) between "'nonce'" and double arrow, but found 1. Open
Open
'nonce' => wp_create_nonce( 'gtm_multisite_admin_security' ),
- Exclude checks
Array closer not aligned correctly; expected 8 space(s) but found 12 Open
Open
)
- Exclude checks
Array item not aligned correctly; expected 12 spaces but found 16 Open
Open
'nonce' => wp_create_nonce( 'gtm_multisite_admin_security' ),
- Exclude checks
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space Open
Open
$gtm_options = (array) get_blog_option( $site_id, 'gtm4wp-options' );
- Exclude checks
Expected 1 space after comma in function call; 4 found Open
Open
$site_id = filter_var( $_POST['site_id'], FILTER_VALIDATE_INT, array( 'default' => 0 ) );
- Exclude checks
Equals sign not aligned with surrounding assignments; expected 13 spaces but found 1 space Open
Open
$gtm_tag_options = get_blog_option( $site_id, 'gtm4wp-options' );
- Exclude checks
Array item not aligned correctly; expected 12 spaces but found 16 Open
Open
'ajaxurl' => $ajaxurl,
- Exclude checks
Expected 1 space after comma in function call; 2 found Open
Open
$gtm_tag = filter_var( $_POST['gtm_tag'], FILTER_SANITIZE_STRING, array( 'default' => 'Add ID' ) );
- Exclude checks
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 5 spaces Open
Open
$response['message'] = 'something went wrong ...';
- Exclude checks