-
Notifications
You must be signed in to change notification settings - Fork 42
Description
What problem would the enhancement address for VIP?
On VIP, we strongly recommend not having no limit queries, as they are not scalable on larger sites: https://lobby.vip.wordpress.com/wordpress-com-documentation/code-review-what-we-look-for/#no-limit-queries
When we moved over the deprecated WPCS VIP sniffs over to VPCS here, the former PostsPerPageSniff on WPCS VIP became known as NoPagingSniff
on VIPCS and the checks for posts_per_page
were removed, as the WordPress.WP.PostsPerPage.posts_per_page_posts_per_page
sniff was intended to be used instead. However, at the time, it wasn't realized that the WPCS PostsPerPage sniff did not check for values of -1
.
Describe the solution you'd like
-
It would be nice to add this upstream onto WPCS's side: Add check for post_per_page to -1 in PostsPerPage sniff WordPress/WordPress-Coding-Standards#1638
-
But if not for 1), we should have a VIPCS sniff that flags this.
What code should be reported as a violation?
$args = [ 'posts_per_page' => -1 ];
What could should not be reported as a violation?
$args = [ 'posts_per_page' => 1 ];
Additional context
Also possibly related: #29