{"action":"created","issue":{"url":"https://api.github.com/repos/WPTRT/WordPress-Coding-Standards/issues/92","repository_url":"https://api.github.com/repos/WPTRT/WordPress-Coding-Standards","labels_url":"https://api.github.com/repos/WPTRT/WordPress-Coding-Standards/issues/92/labels{/name}","comments_url":"https://api.github.com/repos/WPTRT/WordPress-Coding-Standards/issues/92/comments","events_url":"https://api.github.com/repos/WPTRT/WordPress-Coding-Standards/issues/92/events","html_url":"https://github.com/WPTRT/WordPress-Coding-Standards/issues/92","id":196267809,"number":92,"title":"[New sniff][JS] Forbidden functions","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},"labels":[{"id":405809658,"url":"https://api.github.com/repos/WPTRT/WordPress-Coding-Standards/labels/help%20wanted","name":"help wanted","color":"c2e0c6","default":true},{"id":493707255,"url":"https://api.github.com/repos/WPTRT/WordPress-Coding-Standards/labels/issue:%20needs%20PR","name":"issue: needs PR","color":"c5def5","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-12-18T10:05:25Z","updated_at":"2016-12-22T16:51:13Z","closed_at":null,"body":"#### Rule type:\r\nError\r\n\r\n#### Rule:\r\n\r\n> Don't do bad things ;-)\r\n\r\nSimilar to #9 for PHP, a sniff should be created for JS files to detect typical functions which can be used for nefarious purposes.\r\n\r\n#### Theme check file covering this rule:\r\nhttps://github.com/Otto42/theme-check/blob/master/checks/badthings.php (incomplete)\r\n\r\n#### Decision needed:\r\nFor this sniff to be added, a list will need to be compiled of JS functions which should be covere dby this sniff and this list will need to be approved by the TR board.\r\n\r\n#### To do:\r\n- [ ] Compile a list of JS functions which should be covered by this sniff\r\n- [ ] TRT: review the list & get a decision on it\r\n- [ ] Add the rule in the Theme Review handbook to the **_Requirements_** page.\r\n- [ ] Create unit tests\r\n- [ ] Create new sniff\r\n"},"comment":{"url":"https://api.github.com/repos/WPTRT/WordPress-Coding-Standards/issues/comments/268840932","html_url":"https://github.com/WPTRT/WordPress-Coding-Standards/issues/92#issuecomment-268840932","issue_url":"https://api.github.com/repos/WPTRT/WordPress-Coding-Standards/issues/92","id":268840932,"user":{"login":"grappler","id":1785641,"avatar_url":"https://avatars.githubusercontent.com/u/1785641?v=3","gravatar_id":"","url":"https://api.github.com/users/grappler","html_url":"https://github.com/grappler","followers_url":"https://api.github.com/users/grappler/followers","following_url":"https://api.github.com/users/grappler/following{/other_user}","gists_url":"https://api.github.com/users/grappler/gists{/gist_id}","starred_url":"https://api.github.com/users/grappler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grappler/subscriptions","organizations_url":"https://api.github.com/users/grappler/orgs","repos_url":"https://api.github.com/users/grappler/repos","events_url":"https://api.github.com/users/grappler/events{/privacy}","received_events_url":"https://api.github.com/users/grappler/received_events","type":"User","site_admin":false},"created_at":"2016-12-22T16:51:13Z","updated_at":"2016-12-22T16:51:13Z","body":"> If the object is a variable, how would the sniff be able to tell?\r\n\r\nIf the variable is being defined in the same file then we could look for it using CS and find what value it is being assigned. Normally after looking at real life examples we can decide how often variables are used in these cases. Depending on how complex the code would be we may just go with a warning and allow the reviewer check the code manually. We can always make the sniff more secure in the future."}}
{"actor":{"display_login":"grappler"}}