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

Check for functions that are plugin territory #73

Closed
2 of 4 tasks
khacoder opened this issue Aug 22, 2016 · 3 comments
Closed
2 of 4 tasks

Check for functions that are plugin territory #73

khacoder opened this issue Aug 22, 2016 · 3 comments

Comments

@khacoder
Copy link
Contributor

khacoder commented Aug 22, 2016

[Implement sniff] Check for functions that are plugin territory and display an error if found.

Rule type:

Error

Rule:

The theme options should not be pseudo custom post types and save non-trivial user data. Non-design related functionality is not allowed.

Ref: https://make.wordpress.org/themes/handbook/review/required/#presentation-vs-functionality

ERROR | The following three functions are not allowed (plugin territory): register_post_type(), register_taxonomy(), add_shortcode(). Review this list with the Theme Review board as there might be some more functions which could be added. The sniff could probably just extend the Forbidden Functions sniff - though it should be kept as a separate sniff for clarity.

Theme check file covering this rule:

https://github.com/Otto42/theme-check/blob/master/checks/plugin-territory.php

To do:

  • Create unit tests
  • Create new sniff
  • Adjust existing WPCS / PHPCS sniff and send in PR upstream.
  • Add existing sniffname sniff to the ruleset.
@khacoder khacoder self-assigned this Aug 22, 2016
@khacoder
Copy link
Contributor Author

I have this sniff ready to go and will upload after final testing.

@justintadlock
Copy link

More functions:

register_taxonomy_for_object_type()
flush_rewrite_rules()

There's probably a lot more. Those two are a couple of the more common ones I've seen.

@khacoder
Copy link
Contributor Author

Sure, keep adding them, the sniff is easy to change.

@khacoder khacoder removed their assignment Sep 29, 2016
jrfnl pushed a commit that referenced this issue Oct 13, 2016
Add sniff for Plugin Territory Functions

Related to issue #73
@jrfnl jrfnl closed this as completed Oct 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants