From 09336ca5cc1a0578868c4eacd9bc51c5068877e0 Mon Sep 17 00:00:00 2001 From: Rebecca Hum <16962021+rebeccahum@users.noreply.github.com> Date: Mon, 11 Jan 2021 11:17:27 -0700 Subject: [PATCH 1/2] Remove Batcache references in messaging --- WordPress-VIP-Go/ruleset.xml | 5 ----- .../Sniffs/Functions/RestrictedFunctionsSniff.php | 4 ++-- .../Sniffs/Variables/RestrictedVariablesSniff.php | 2 +- .../Tests/Functions/RestrictedFunctionsUnitTest.inc | 2 +- .../Tests/Functions/RestrictedFunctionsUnitTest.php | 2 +- 5 files changed, 5 insertions(+), 10 deletions(-) diff --git a/WordPress-VIP-Go/ruleset.xml b/WordPress-VIP-Go/ruleset.xml index a196e658..d50d0a10 100644 --- a/WordPress-VIP-Go/ruleset.xml +++ b/WordPress-VIP-Go/ruleset.xml @@ -93,19 +93,14 @@ Hiding of admin bar is highly discouraged for user roles of "administrator" and "vip_support" -- if these roles are already excluded, this warning can be ignored. - error 6 - Due to server-side caching, server-side based client related logic might not work. We recommend implementing client side logic in JavaScript instead. - error 6 - Due to server-side caching, server-side based client related logic might not work. We recommend implementing client side logic in JavaScript instead. error 6 - Due to server-side caching, server-side based client related logic might not work. We recommend implementing client side logic in JavaScript instead. diff --git a/WordPressVIPMinimum/Sniffs/Functions/RestrictedFunctionsSniff.php b/WordPressVIPMinimum/Sniffs/Functions/RestrictedFunctionsSniff.php index 74995407..05cce840 100644 --- a/WordPressVIPMinimum/Sniffs/Functions/RestrictedFunctionsSniff.php +++ b/WordPressVIPMinimum/Sniffs/Functions/RestrictedFunctionsSniff.php @@ -310,8 +310,8 @@ public function getGroups() { // @link WordPress.com: https://lobby.vip.wordpress.com/wordpress-com-documentation/code-review-what-we-look-for/#custom-roles // @link VIP Go: https://wpvip.com/documentation/vip-go/code-review-blockers-warnings-notices/#cache-constraints 'cookies' => [ - 'type' => 'warning', - 'message' => 'Due to using Batcache, server side based client related logic will not work, use JS instead.', + 'type' => 'error', + 'message' => 'Due to server-side caching, server-side based client related logic might not work. We recommend implementing client side logic in JavaScript instead.', 'functions' => [ 'setcookie', ], diff --git a/WordPressVIPMinimum/Sniffs/Variables/RestrictedVariablesSniff.php b/WordPressVIPMinimum/Sniffs/Variables/RestrictedVariablesSniff.php index 7b6d7917..f750f660 100644 --- a/WordPressVIPMinimum/Sniffs/Variables/RestrictedVariablesSniff.php +++ b/WordPressVIPMinimum/Sniffs/Variables/RestrictedVariablesSniff.php @@ -57,7 +57,7 @@ public function getGroups() { // @link https://lobby.vip.wordpress.com/wordpress-com-documentation/code-review-what-we-look-for/#caching-constraints 'cache_constraints' => [ 'type' => 'warning', - 'message' => 'Due to using Batcache, server side based client related logic will not work, use JS instead.', + 'message' => 'Due to server-side caching, server-side based client related logic might not work. We recommend implementing client side logic in JavaScript instead.', 'variables' => [ '$_COOKIE', ], diff --git a/WordPressVIPMinimum/Tests/Functions/RestrictedFunctionsUnitTest.inc b/WordPressVIPMinimum/Tests/Functions/RestrictedFunctionsUnitTest.inc index 7c1ba946..79e3569a 100644 --- a/WordPressVIPMinimum/Tests/Functions/RestrictedFunctionsUnitTest.inc +++ b/WordPressVIPMinimum/Tests/Functions/RestrictedFunctionsUnitTest.inc @@ -122,7 +122,7 @@ vip_safe_wp_remote_get(); // Ok - VIP recommended version of wp_remote_get(). wp_remote_get( $url ); // Warning. cookie( $_GET['test'] ); // Ok - similarly-named function to setcookie(). -setcookie( 'cookie[three]', 'cookiethree' ); // Warning. +setcookie( 'cookie[three]', 'cookiethree' ); // Error. get_post( 123 ); // Ok - not using get_posts(). wp_get_recent_post(); // Ok - similarly-named function to wp_get_recent_posts(). diff --git a/WordPressVIPMinimum/Tests/Functions/RestrictedFunctionsUnitTest.php b/WordPressVIPMinimum/Tests/Functions/RestrictedFunctionsUnitTest.php index 493b9270..ada3fd5e 100644 --- a/WordPressVIPMinimum/Tests/Functions/RestrictedFunctionsUnitTest.php +++ b/WordPressVIPMinimum/Tests/Functions/RestrictedFunctionsUnitTest.php @@ -59,6 +59,7 @@ public function getErrorList() { 101 => 1, 104 => 1, 107 => 1, + 125 => 1, 141 => 1, 142 => 1, 143 => 1, @@ -128,7 +129,6 @@ public function getWarningList() { 118 => 1, 119 => 1, 122 => 1, - 125 => 1, 130 => 1, 131 => 1, 132 => 1, From 09945def2376cdaa04cf1c948d057340cc375715 Mon Sep 17 00:00:00 2001 From: Rebecca Hum <16962021+rebeccahum@users.noreply.github.com> Date: Mon, 11 Jan 2021 11:19:40 -0700 Subject: [PATCH 2/2] Add back error type since we aren't changing the parent yet --- WordPress-VIP-Go/ruleset.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/WordPress-VIP-Go/ruleset.xml b/WordPress-VIP-Go/ruleset.xml index d50d0a10..f0584eea 100644 --- a/WordPress-VIP-Go/ruleset.xml +++ b/WordPress-VIP-Go/ruleset.xml @@ -96,6 +96,7 @@ 6 + error 6