-
Notifications
You must be signed in to change notification settings - Fork 54
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
Add Enqueued Resources check #331
Add Enqueued Resources check #331
Conversation
044b411
to
3c40a45
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for addressing the checks. I have provided some feedback for your consideration.
Regarding this matter, we are currently in the process of evaluating the acceptance criteria for this check. I don't believe it's fully prepared for engineering work yet. @felixarntz, could you please share your thoughts on this?
tests/phpunit/testdata/plugins/test-plugin-enqueued-resources-with-errors/load.php
Outdated
Show resolved
Hide resolved
3c40a45
to
df3d289
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ernilambar @mukeshpanchal27 I think it might be okay to merge this as it's a simple check using WPCS and it's certainly a best practice. I would however prefer to check with the plugin review team whether they're okay with it.
I think in any case it could be merged as a warning, but right now it is an error and I would like to validate whether that's okay with the review team.
The other thing is that the category of this check should IMO be a different one.
The WPCS itself return error https://github.com/WordPress/WordPress-Coding-Standards/blob/develop/WordPress/Sniffs/WP/EnqueuedResourcesSniff.php#L65 so we should return error for this check. Please correct me if i miss anything. Thanks! |
In the Acceptance Criteria in #25 it is mentioned that warnings should be displayed. |
It seems the AC are not currently up to date and haven't been approved by any team member. Perhaps this was mistakenly labeled as a notice when, in fact, the sniff itself returns an error, indicating that we should display an error message. |
a26cde8
to
dddb163
Compare
PR has been rebased. |
Hello, |
e1c6c00
to
232aaf2
Compare
228d1f3
to
cc8bc0f
Compare
PR has been updated and ready for review. |
Hello, I have compared Internal Scanner and this check and is not giving same results. For example is not detecting this code:
What we are doing in our scanner is using regex. @frantorres could help as well on this. I give you the regex that we are using: script_type: script_only: link: link-type: style: They were tested and working correctly. I don't know the best approach, but WPCS seems not to be the only one. |
I've reviewed with Fran, and We could suggest to WPCS to have better detection of enqueues. |
Yes, contributing to WPCS would be best here 👍 Right now it only has 2 regexes for external scripts/styles, none for inline scripts etc. Code in question: https://github.com/WordPress/WordPress-Coding-Standards/blob/d77b0204f49e4b4a2bbac791e3bbfbfe603edf06/WordPress/Sniffs/WP/EnqueuedResourcesSniff.php#L51-L81 |
Feedback is old and has been addressed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All seems ok. We're going to make an issue to WPCS in order to have better detection of enqueues.
Fixes #25
Note: