-
Notifications
You must be signed in to change notification settings - Fork 60
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
Question about PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage sniff #831
Comments
A static code analysis tool does not know whether an image is used in the WP admin or elsewhere. So the idea behind that was to warn about this to catch cases where another function may be more appropriate. In some places that's not possible, in which case it can be ignored. What we might be able to do here is enhancing this check to look for things like |
I understand. But this may be show this rule has been implemented too soon, precisely. Please be aware that the rule throws errors, not warnings. My CI fails, I disabled a month ago for that very reason. |
As of #822 it's only a warning, it just hasn't been published in a new release yet. |
I don't get it. The github action is still throwing errors, so is the wordpress plugin . Using github action "main", and latest wordpress plugin. Both throw errors. |
I have the same issues with build-in images in some of my plugins. The Plugin Check show errors. |
version 1.4 fixed the issue. |
Note: I closed the question, but I didn't receive any responses. For the records, I don't see why developpers should use wp_get_attachment_image() for their plugin development. They should be free to use images that have not been uploaded to wordpress. Adding a picture shouldn't throw an error, and neither a warning. |
Hi there,
I don't understand the point of this new PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage as implemented there:
plugin-check/phpcs-sniffs/PluginCheck/Sniffs/CodeAnalysis/ImageFunctionsSniff.php
which results in
Images should be added using wp_get_attachment_image() or similar functions
For many of the WP plugins makers , we add images in the WP admin backoffice. Those images are not uploaded to WP gallery, but rather static files called the good old way with an . There is no way to bypass the regex, which will detect any in the plugin.
It is my understanding you're going to change it a warning, as discussed here #757 but I'm questionning even such a warning. To my understanding, even a warning is not appropriate for plugins makers.
Even if the aim is undertandable, in practice it doesn't make sense to me.
The text was updated successfully, but these errors were encountered: