{"action":"created","comment":{"url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/pulls/comments/71085386","id":71085386,"diff_hunk":"@@ -0,0 +1,289 @@\n+<?php\n+/**\n+ * WordPress Coding Standard.\n+ *\n+ * @category PHP\n+ * @package  PHP_CodeSniffer\n+ * @link     https://make.wordpress.org/core/handbook/best-practices/coding-standards/\n+ */\n+\n+/**\n+ * Use lowercase letters in action and filter names. Separate words via underscores.\n+ *\n+ * @link     https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/#naming-conventions\n+ *\n+ * @category PHP\n+ * @package  PHP_CodeSniffer\n+ * @author   Juliette Reinders Folmer <wpplugins_nospam@adviesenzo.nl>\n+ */\n+class WordPress_Sniffs_NamingConventions_ValidHookNameSniff implements PHP_CodeSniffer_Sniff {\n+\n+\t/**\n+\t * Additional word separators.\n+\t *\n+\t * This public variable allows providing additional word separators which\n+\t * will be allowed in hook names via a property in the phpcs.xml config file.\n+\t *\n+\t * Example usage:\n+\t * <rule ref=\"WordPress.NamingConventions.ValidHookName\">\n+\t *   <properties>\n+\t *     <property name=\"additionalWordDelimiters\" value=\"-\"/>\n+\t *   </properties>\n+\t * </rule>\n+\t *\n+\t * Provide several extra delimiters as one string:\n+\t * <rule ref=\"WordPress.NamingConventions.ValidHookName\">\n+\t *   <properties>\n+\t *     <property name=\"additionalWordDelimiters\" value=\"-/.\"/>\n+\t *   </properties>\n+\t * </rule>\n+\t *\n+\t * @var string\n+\t */\n+\tpublic $additionalWordDelimiters = '';\n+\n+\t/**\n+\t * Regular expression to test for correct punctuation of a hook name.\n+\t *\n+\t * The placeholder will be replaced by potentially provided additional\n+\t * word delimiters in the `prepare_regex()` method.\n+\t *\n+\t * @var string\n+\t */\n+\tprotected $punctuation_regex = '`[^\\w%s]`';\n+\n+\t/**\n+\t * Functions we're interested in.\n+\t *\n+\t * Only testing the hook call functions as when using 'add_action'/'add_filter' you can't influence\n+\t * the hook name.\n+\t *\n+\t * @var array\n+\t */\n+\tprotected $hook_functions = array(\n+\t\t'do_action',\n+\t\t'do_action_ref_array',\n+\t\t'apply_filters',\n+\t\t'apply_filters_ref_array',\n+\t);","path":"WordPress/Sniffs/NamingConventions/ValidHookNameSniff.php","position":68,"original_position":68,"commit_id":"2a6e16f9abfbdf2d7e426ff8b80d0e360f5ab5e7","original_commit_id":"2a6e16f9abfbdf2d7e426ff8b80d0e360f5ab5e7","user":{"login":"JDGrimes","id":4005415,"avatar_url":"https://avatars.githubusercontent.com/u/4005415?v=3","gravatar_id":"","url":"https://api.github.com/users/JDGrimes","html_url":"https://github.com/JDGrimes","followers_url":"https://api.github.com/users/JDGrimes/followers","following_url":"https://api.github.com/users/JDGrimes/following{/other_user}","gists_url":"https://api.github.com/users/JDGrimes/gists{/gist_id}","starred_url":"https://api.github.com/users/JDGrimes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JDGrimes/subscriptions","organizations_url":"https://api.github.com/users/JDGrimes/orgs","repos_url":"https://api.github.com/users/JDGrimes/repos","events_url":"https://api.github.com/users/JDGrimes/events{/privacy}","received_events_url":"https://api.github.com/users/JDGrimes/received_events","type":"User","site_admin":false},"body":"We generally make the function names keys so that `isset()` can be used instead of `in_array()`. Also, most of these lists should go in the main sniff class so that they can be reused across sniffs.\r\n\r\nAlso, `do_action_deprecated()` and `apply_filters_deprecated()` could be added. https://core.trac.wordpress.org/changeset/37861","created_at":"2016-07-17T16:44:32Z","updated_at":"2016-07-17T16:44:32Z","html_url":"https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/pull/599#discussion_r71085386","pull_request_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/pulls/599","_links":{"self":{"href":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/pulls/comments/71085386"},"html":{"href":"https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/pull/599#discussion_r71085386"},"pull_request":{"href":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/pulls/599"}}},"pull_request":{"url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/pulls/599","id":77428739,"html_url":"https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/pull/599","diff_url":"https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/pull/599.diff","patch_url":"https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/pull/599.patch","issue_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/599","number":599,"state":"open","locked":false,"title":"Add new sniff to check whether a hook name is valid.","user":{"login":"jrfnl","id":663378,"avatar_url":"https://avatars.githubusercontent.com/u/663378?v=3","gravatar_id":"","url":"https://api.github.com/users/jrfnl","html_url":"https://github.com/jrfnl","followers_url":"https://api.github.com/users/jrfnl/followers","following_url":"https://api.github.com/users/jrfnl/following{/other_user}","gists_url":"https://api.github.com/users/jrfnl/gists{/gist_id}","starred_url":"https://api.github.com/users/jrfnl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrfnl/subscriptions","organizations_url":"https://api.github.com/users/jrfnl/orgs","repos_url":"https://api.github.com/users/jrfnl/repos","events_url":"https://api.github.com/users/jrfnl/events{/privacy}","received_events_url":"https://api.github.com/users/jrfnl/received_events","type":"User","site_admin":false},"body":"Covers the `action` part of this rule in the handbook:\r\n> Use lowercase letters in variable, **action**, and function names (never camelCase). Separate words via underscores.\r\n\r\nRef: https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/#naming-conventions\r\n\r\nReview appreciated.\r\n\r\nAlso: I've made non-lowercase hook names an `error` and non-underscore punctuation a `warning`. Should that also be an `error` ?","created_at":"2016-07-14T09:54:22Z","updated_at":"2016-07-17T16:44:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4983384b670953e967c0f8054acfaae0e86e8d69","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/pulls/599/commits","review_comments_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/pulls/599/comments","review_comment_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/pulls/comments{/number}","comments_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/599/comments","statuses_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/statuses/2a6e16f9abfbdf2d7e426ff8b80d0e360f5ab5e7","head":{"label":"jrfnl:WPCS/feature/lowercase-filter-names","ref":"WPCS/feature/lowercase-filter-names","sha":"2a6e16f9abfbdf2d7e426ff8b80d0e360f5ab5e7","user":{"login":"jrfnl","id":663378,"avatar_url":"https://avatars.githubusercontent.com/u/663378?v=3","gravatar_id":"","url":"https://api.github.com/users/jrfnl","html_url":"https://github.com/jrfnl","followers_url":"https://api.github.com/users/jrfnl/followers","following_url":"https://api.github.com/users/jrfnl/following{/other_user}","gists_url":"https://api.github.com/users/jrfnl/gists{/gist_id}","starred_url":"https://api.github.com/users/jrfnl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrfnl/subscriptions","organizations_url":"https://api.github.com/users/jrfnl/orgs","repos_url":"https://api.github.com/users/jrfnl/repos","events_url":"https://api.github.com/users/jrfnl/events{/privacy}","received_events_url":"https://api.github.com/users/jrfnl/received_events","type":"User","site_admin":false},"repo":{"id":12999615,"name":"WordPress-Coding-Standards","full_name":"jrfnl/WordPress-Coding-Standards","owner":{"login":"jrfnl","id":663378,"avatar_url":"https://avatars.githubusercontent.com/u/663378?v=3","gravatar_id":"","url":"https://api.github.com/users/jrfnl","html_url":"https://github.com/jrfnl","followers_url":"https://api.github.com/users/jrfnl/followers","following_url":"https://api.github.com/users/jrfnl/following{/other_user}","gists_url":"https://api.github.com/users/jrfnl/gists{/gist_id}","starred_url":"https://api.github.com/users/jrfnl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrfnl/subscriptions","organizations_url":"https://api.github.com/users/jrfnl/orgs","repos_url":"https://api.github.com/users/jrfnl/repos","events_url":"https://api.github.com/users/jrfnl/events{/privacy}","received_events_url":"https://api.github.com/users/jrfnl/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jrfnl/WordPress-Coding-Standards","description":"PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions","fork":true,"url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards","forks_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/forks","keys_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/teams","hooks_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/hooks","issue_events_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/issues/events{/number}","events_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/events","assignees_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/assignees{/user}","branches_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/branches{/branch}","tags_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/tags","blobs_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/git/refs{/sha}","trees_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/statuses/{sha}","languages_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/languages","stargazers_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/stargazers","contributors_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/contributors","subscribers_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/subscribers","subscription_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/subscription","commits_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/commits{/sha}","git_commits_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/git/commits{/sha}","comments_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/comments{/number}","issue_comment_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/issues/comments{/number}","contents_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/contents/{+path}","compare_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/merges","archive_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/downloads","issues_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/issues{/number}","pulls_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/pulls{/number}","milestones_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/milestones{/number}","notifications_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/labels{/name}","releases_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/releases{/id}","deployments_url":"https://api.github.com/repos/jrfnl/WordPress-Coding-Standards/deployments","created_at":"2013-09-21T17:57:30Z","updated_at":"2015-03-17T15:13:05Z","pushed_at":"2016-07-17T16:38:23Z","git_url":"git://github.com/jrfnl/WordPress-Coding-Standards.git","ssh_url":"git@github.com:jrfnl/WordPress-Coding-Standards.git","clone_url":"https://github.com/jrfnl/WordPress-Coding-Standards.git","svn_url":"https://github.com/jrfnl/WordPress-Coding-Standards","homepage":"","size":968,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"WordPress-Coding-Standards:develop","ref":"develop","sha":"21abfbe72d6c6bc9a599674b56c3fe4409512f88","user":{"login":"WordPress-Coding-Standards","id":3841697,"avatar_url":"https://avatars.githubusercontent.com/u/3841697?v=3","gravatar_id":"","url":"https://api.github.com/users/WordPress-Coding-Standards","html_url":"https://github.com/WordPress-Coding-Standards","followers_url":"https://api.github.com/users/WordPress-Coding-Standards/followers","following_url":"https://api.github.com/users/WordPress-Coding-Standards/following{/other_user}","gists_url":"https://api.github.com/users/WordPress-Coding-Standards/gists{/gist_id}","starred_url":"https://api.github.com/users/WordPress-Coding-Standards/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WordPress-Coding-Standards/subscriptions","organizations_url":"https://api.github.com/users/WordPress-Coding-Standards/orgs","repos_url":"https://api.github.com/users/WordPress-Coding-Standards/repos","events_url":"https://api.github.com/users/WordPress-Coding-Standards/events{/privacy}","received_events_url":"https://api.github.com/users/WordPress-Coding-Standards/received_events","type":"Organization","site_admin":false},"repo":{"id":1691187,"name":"WordPress-Coding-Standards","full_name":"WordPress-Coding-Standards/WordPress-Coding-Standards","owner":{"login":"WordPress-Coding-Standards","id":3841697,"avatar_url":"https://avatars.githubusercontent.com/u/3841697?v=3","gravatar_id":"","url":"https://api.github.com/users/WordPress-Coding-Standards","html_url":"https://github.com/WordPress-Coding-Standards","followers_url":"https://api.github.com/users/WordPress-Coding-Standards/followers","following_url":"https://api.github.com/users/WordPress-Coding-Standards/following{/other_user}","gists_url":"https://api.github.com/users/WordPress-Coding-Standards/gists{/gist_id}","starred_url":"https://api.github.com/users/WordPress-Coding-Standards/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WordPress-Coding-Standards/subscriptions","organizations_url":"https://api.github.com/users/WordPress-Coding-Standards/orgs","repos_url":"https://api.github.com/users/WordPress-Coding-Standards/repos","events_url":"https://api.github.com/users/WordPress-Coding-Standards/events{/privacy}","received_events_url":"https://api.github.com/users/WordPress-Coding-Standards/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards","description":"PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions","fork":false,"url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards","forks_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/forks","keys_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/keys{/key_id}","collaborators_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/teams","hooks_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/hooks","issue_events_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/events{/number}","events_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/events","assignees_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/assignees{/user}","branches_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/branches{/branch}","tags_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/tags","blobs_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/git/refs{/sha}","trees_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/git/trees{/sha}","statuses_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/statuses/{sha}","languages_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/languages","stargazers_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/stargazers","contributors_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/contributors","subscribers_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/subscribers","subscription_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/subscription","commits_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/commits{/sha}","git_commits_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/git/commits{/sha}","comments_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/comments{/number}","issue_comment_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/comments{/number}","contents_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/contents/{+path}","compare_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/compare/{base}...{head}","merges_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/merges","archive_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/downloads","issues_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/issues{/number}","pulls_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/pulls{/number}","milestones_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/milestones{/number}","notifications_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/labels{/name}","releases_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/releases{/id}","deployments_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/deployments","created_at":"2011-05-02T12:49:18Z","updated_at":"2016-07-16T05:50:13Z","pushed_at":"2016-07-17T16:21:53Z","git_url":"git://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git","ssh_url":"git@github.com:WordPress-Coding-Standards/WordPress-Coding-Standards.git","clone_url":"https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git","svn_url":"https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards","homepage":"","size":1887,"stargazers_count":677,"watchers_count":677,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":135,"mirror_url":null,"open_issues_count":86,"forks":135,"open_issues":86,"watchers":677,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/pulls/599"},"html":{"href":"https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/pull/599"},"issue":{"href":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/599"},"comments":{"href":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/599/comments"},"review_comments":{"href":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/pulls/599/comments"},"review_comment":{"href":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/pulls/599/commits"},"statuses":{"href":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/statuses/2a6e16f9abfbdf2d7e426ff8b80d0e360f5ab5e7"}}}}
{"actor":{"display_login":"JDGrimes"}}