Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove user_meta related sniffs #614

Closed
rebeccahum opened this issue Jan 11, 2021 · 3 comments · Fixed by #652
Closed

Remove user_meta related sniffs #614

rebeccahum opened this issue Jan 11, 2021 · 3 comments · Fixed by #652
Milestone

Comments

@rebeccahum
Copy link
Contributor

User meta is easily accessible on VIP Go, no reason to have the user_meta grouping in the RestrictedFunctions sniff:

'user_meta' => [
'type' => 'error',
'message' => '%s() usage is highly discouraged on WordPress.com VIP due to it being a multisite, please see https://lobby.vip.wordpress.com/wordpress-com-documentation/code-review-what-we-look-for/#wp_users-and-user_meta.',
'functions' => [
'get_user_meta',
'update_user_meta',
'delete_user_meta',
'add_user_meta',
],
],

We silence it anyways on the WordPress-VIP-Go ruleset:

<rule ref="WordPressVIPMinimum.Functions.RestrictedFunctions.user_meta_add_user_meta">
<severity>0</severity>
</rule>
<rule ref="WordPressVIPMinimum.Functions.RestrictedFunctions.user_meta_delete_user_meta">
<severity>0</severity>
</rule>
<rule ref="WordPressVIPMinimum.Functions.RestrictedFunctions.user_meta_get_user_meta">
<severity>0</severity>
</rule>
<rule ref="WordPressVIPMinimum.Functions.RestrictedFunctions.user_meta_update_user_meta">

The same could be said for the RestrictedVariables sniff:

'user_meta' => [
'type' => 'error',
'message' => 'Usage of users/usermeta tables is highly discouraged in VIP context, For storing user additional user metadata, you should look at User Attributes.',
'object_vars' => [
'$wpdb->users',
'$wpdb->usermeta',
],

Silenced on the same ruleset:

<rule ref="WordPressVIPMinimum.Variables.RestrictedVariables.user_meta__wpdb__usermeta">
<severity>0</severity>
</rule>

@rebeccahum rebeccahum modified the milestone: 3.x Jan 11, 2021
@jrfnl
Copy link
Collaborator

jrfnl commented Mar 2, 2021

Loosely related to #600.

The difference between #600 and these changes, is that these are not breaking changes as no sniffs are removed, only error codes (and groups).

This means that this change might make some inline ignore annotations redundant and possibly make some values in custom properties in rulesets redundant, but other than that, it will not break rulesets and it will not break runs.

In other words, these changes are "allowed" to go into a next minor and don't need to wait for the next major (though a choice can be made to let this wait for the next major anyway).

@jrfnl
Copy link
Collaborator

jrfnl commented Mar 2, 2021

I have prepared the commits for this. @rebeccahum Let me know if you want me to pull these changes now or when we're preparing for v3.0.

@rebeccahum
Copy link
Contributor Author

rebeccahum commented Mar 26, 2021

@jrfnl Please pull the changes now. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants