Closed amritcheema25 closed 6 years ago
Thanks @amritcheema25.
This needs to be fixed in our config, but for now you can bandaid it in your project by adding the following to your phpcs.xml
:
<rule ref="WordPress-VIP">
<exclude name="WordPress.VIP.RestrictedFunctions.get_term_link" />
</rule>
If you would like to assign this issue to yourself and do it in this config that would be even better! Just add a comment to explain it, and then pushing to master and tagging will automatically issue a new release.
Ok sure @tdmalone Thanks 👍
Further background: we may consider adding some of the WordPress VIP functions to the parent theme at a later date. When and if we do that, we can re-enable these rules and use those functions for better performance. #11 exists for this.
@amritcheema25 if you can add this back into this repo (phpcs-config) from your client project to exclude the VIP functions that would be great
@daviddeejjames I have excluded some of vip functions for which i was getting errors. @tdmalone i have not merge it with master yet. Refer to commit :- https://github.com/ChromatixAU/phpcs-config-chromatix/commit/9e1b086bb3158a616220f69c8a58244eb815bae7
Thanks @amritcheema25, that's all good to merge to master (pls don't close the issue until we get to that point, just so it doesn't get lost or forgotten :) - FYI you can add the text eg. (closes #20)
to your commit message to have it automatically close the related issue when it's merged).
Also, I've checked the WordPress standards to see which functions are prohibited. Most of them are due to wpcom_vip_
replacements, which we don't have access to (yet), or due to specifics of the VIP hosting platform. Therefore those are all ok to remove the restriction on for our config. We can review adding the function restrictions later if we add the wpcom_vip_
funcs to our themes.
However, there is one restriction we need to keep: the get_posts
restriction, because this function shouldn't be used in WordPress anymore due to performance issues.
Therefore, given the above, you could probably exclude WordPress.VIP.RestrictedFunctions
and then just re-add WordPress.VIP.RestrictedFunctions.get_posts
- just check it works properly first; you could do this in a local project's phpcs.xml
before adding to this config.
WordPress.VIP.RestrictedFunctions.get_term_link_get_category_link
Latest v0.0.15 giving linting error :- [phpcs] get_category_link() is prohibited, please use wpcom_vip_get_term_link() instead.