-
-
Notifications
You must be signed in to change notification settings - Fork 490
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
Updated - WP.AlternativeFunctions: Add more functions to filesystem functions list #2108
Updated - WP.AlternativeFunctions: Add more functions to filesystem functions list #2108
Conversation
Will make it easier to see changes.
These functions were in the `VIP.FileSystemWritesDisallowed` sniff, and it seemed like a good idea to add them here as well.
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.
Thanks for making this update @sandeshjangam ! Looking good.
I've left some small remarks. Other than that, could you please add some tests for the new functions ?
Adding tests for this, is basically just a case of adding a line with a function call to each of these functions in the WordPress/Tests/WP/AlternativeFunctionsUnitTest.inc
file and then adding the line numbers for the lines containing those function calls to the WordPress/Tests/WP/AlternativeFunctionsUnitTest.php
file.
@sandeshjangam Just checking - will you have a change to update the PR in the next few days ? I'd like to include this in WPCS 3.0.0, but if not, I'll just move it out of the milestone. |
@jrfnl Trying to finish it today itself. I will update you here. |
@jrfnl Changes done as per suggestions and added test cases also. |
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.
Other than those things pointed out by @GaryJones, this PR looks good to me. Thanks for making those updates @sandeshjangam !
Co-authored-by: Gary Jones <github@garyjones.io>
Co-authored-by: Gary Jones <github@garyjones.io>
Co-authored-by: Gary Jones <github@garyjones.io>
Thanks for the feedback. All changes are done now. |
The ruleset tests were failing mainly due to WordPress/WordPress-Coding-Standards#2108 which renamed some violation codes that we were excluding. The other change to account for was the replacement of a WPCS StrictComparisons sniff with a PHPCSExtras Universal sniff. The sniff in PHPCSExtra contains a fixer. As this is a risky fixer, this fixer is turned off for WPCS. The sniff in PHPCSExtra will provide metrics about loose versus strict comparisons.
The ruleset tests were failing mainly due to WordPress/WordPress-Coding-Standards#2108 which renamed some violation codes that we were excluding. The other change to account for was the replacement of a WPCS StrictComparisons sniff with a PHPCSExtras Universal sniff. The sniff in PHPCSExtra contains a fixer. As this is a risky fixer, this fixer is turned off for WPCS. The sniff in PHPCSExtra will provide metrics about loose versus strict comparisons.
The ruleset tests were failing mainly due to WordPress/WordPress-Coding-Standards#2108 which renamed some violation codes that we were excluding. The other change to account for was the replacement of a WPCS StrictComparisons sniff with a PHPCSExtras Universal sniff. The sniff in PHPCSExtra contains a fixer. As this is a risky fixer, this fixer is turned off for WPCS. The sniff in PHPCSExtra will provide metrics about loose versus strict comparisons.
The ruleset tests were failing mainly due to WordPress/WordPress-Coding-Standards#2108 which renamed some violation codes that we were excluding. The other change to account for was the replacement of a WPCS StrictComparisons sniff with a PHPCSExtras Universal sniff. The sniff in PHPCSExtra contains a fixer. As this is a risky fixer, this fixer is turned off for WPCS. The sniff in PHPCSExtra will provide metrics about loose versus strict comparisons.
The ruleset tests were failing mainly due to WordPress/WordPress-Coding-Standards#2108 which renamed some violation codes that we were excluding. The other change to account for was the replacement of a WPCS StrictComparisons sniff with a PHPCSExtras Universal sniff. The sniff in PHPCSExtra contains a fixer. As this is a risky fixer, this fixer is turned off for WPCS. The sniff in PHPCSExtra will provide metrics about loose versus strict comparisons.
Closes #1265
WP_File_System
and remove any functions from the list which don't have aWP_File_System
counterpart.If there is no replacement function, the sniff would throw a non-actionable error/warning, which effectively is just noise.
WP_File_System
), set those up in separate groups with an informative warning/error message.file_get_contents()
from the list as it is already checked in another group in the same sniff (with logic to prevent triggering on opening of local files) and we don't want to throw duplicate notices.