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

FileSystemWritesDisallow: Use the WPCS abstract function call sniff #800

Merged
merged 2 commits into from
Jan 21, 2017

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Jan 17, 2017

There were three sniffs which still extended the upstream Generic_Sniffs_PHP_ForbiddenFunctionsSniff class.
Extending the WordPress_AbstractFunctionRestrictionsSniff instead has the following advantages:

  • Functions can be provided in groups and the exclude property to selectively exclude groups becomes available.
  • The sniffs no longer have a public $forbiddenFunctions property which could be overruled via the ruleset.
  • Once callback checks have been added to the WordPress_AbstractFunctionRestrictionsSniff, the sniffs will benefit from the additional detection. (see Restricted functions used in callbacks #611)
  • If needed at some point, the functions within the WordPress_Sniff class are available for use.

This PR addresses the above for the VIP.FileSystemWritesDisallow sniff.

This PR contains no significant functional changes. The sniff effectively still does the same.

Notes:

  • The errorcode changes to the groupname instead of being fixed at FileWriteDetected.
  • Split up the functions array into logical groups and alphabetized the lists.
  • Removed some duplicates from the functions array.
  • Added additional unit tests to make sure all functions being sniffed for are unit tested

Related to #614

jrfnl added 2 commits January 17, 2017 07:08
This PR contains no significant functional changes. The sniff effectively still does the same.

Notes:
    * The errorcode changes to the groupname instead of being fixed at `FileWriteDetected`.
    * Split up the functions array into logical groups and alphabetized the lists.
    * Removed some duplicates from the functions array.
@jrfnl jrfnl added this to the 0.11.0 milestone Jan 18, 2017
@JDGrimes JDGrimes merged commit 980a8a7 into develop Jan 21, 2017
@JDGrimes JDGrimes deleted the feature/vip-filewrite-to-wpcs-abstract branch January 21, 2017 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants