Skip to content

Commit 65f3094

Browse files
rebeccahumGaryJones
authored andcommitted
Add test for silencing short echo tag per #386
1 parent 7b585e4 commit 65f3094

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

WordPress-VIP-Go/ruleset-test.inc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -271,15 +271,12 @@ switch_to_blog( $blogid ); // Warning + Message.
271271
// WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn
272272
$args( [
273273
'post__not_in' => array( 1, 2, 3 ), // Warning.
274-
'posts_per_page' => 1,
275274
] );
276275

277276
/* Rules that are being silenced and should NOT be flagged. */
278277

279278
// WordPress.DB.SlowDBQuery.slow_db_query_meta_key
280-
$query = new WP_Query( [
281-
'meta_key' => 'foo', // Ok.
282-
] );
279+
$query = new WP_Query( ['meta_key' => 'foo' ] ); // Ok.
283280
$args = 'foo=bar&meta_key=foo'; // Ok.
284281

285282
// WordPressVIPMinimum.Performance.BatcacheWhitelistedParams
@@ -311,16 +308,19 @@ update_site_option( $bar, $foo, true ); // Ok.
311308
// WordPressVIPMinimum.Functions.RestrictedFunctions.site_option_add_site_option
312309
add_site_option( 'foo', $bar ); // Ok.
313310

311+
// Generic.PHP.DisallowShortOpenTag.EchoFound
312+
?> <?= esc_html( $var ); // Ok. ?> <?php
313+
314314
/* The below rules are inherited from WordPressVIPMinimum */
315315

316316
// WordPressVIPMinimum.Classes.DeclarationCompatibility
317317
class MyWidget extends WP_Widget {
318-
function widget() { // Error.
319-
}
318+
function widget() { } // Error.
320319
}
321320

322321
// WordPressVIPMinimum.Classes.RestrictedExtendClasses
323-
class BadTestClass extends WP_CLI_Command { } // Warning.
322+
class BadTestClass extends WP_CLI_Command { // Warning.
323+
}
324324

325325
// WordPressVIPMinimum.Compatibility.ZoninatorSniff
326326
wpcom_vip_load_plugin( 'zoninator', 'plugins', '0.8' ); // Warning.

WordPress-VIP-Go/ruleset-test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@
214214
265 => 1,
215215
269 => 1,
216216
273 => 1,
217-
323 => 1,
217+
322 => 1,
218218
326 => 1,
219219
332 => 1,
220220
416 => 1,

0 commit comments

Comments
 (0)