{"action":"created","issue":{"url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/604","labels_url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/604/labels{/name}","comments_url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/604/comments","events_url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/604/events","html_url":"https://github.com/squizlabs/PHP_CodeSniffer/issues/604","id":82006459,"number":604,"title":"Selectively disable rules with codingStandardsIgnoreStart and codingStandardsIgnoreLine","user":{"login":"westonruter","id":134745,"avatar_url":"https://avatars.githubusercontent.com/u/134745?v=3","gravatar_id":"","url":"https://api.github.com/users/westonruter","html_url":"https://github.com/westonruter","followers_url":"https://api.github.com/users/westonruter/followers","following_url":"https://api.github.com/users/westonruter/following{/other_user}","gists_url":"https://api.github.com/users/westonruter/gists{/gist_id}","starred_url":"https://api.github.com/users/westonruter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/westonruter/subscriptions","organizations_url":"https://api.github.com/users/westonruter/orgs","repos_url":"https://api.github.com/users/westonruter/repos","events_url":"https://api.github.com/users/westonruter/events{/privacy}","received_events_url":"https://api.github.com/users/westonruter/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-05-28T16:11:46Z","updated_at":"2015-05-29T02:24:45Z","closed_at":null,"body":"PHPCS supports comment directives like:\r\n\r\n```php\r\n// @codingStandardsIgnoreFile\r\n// @codingStandardsIgnoreStart\r\n// @codingStandardsIgnoreLine\r\n```\r\n\r\nHowever, these are all or nothing. What would be even more useful is if we can selectively ignore certain sniffs or errors within sniffs. For instance:\r\n\r\n```php\r\n$q = new WP_Query( array(\r\n    'posts_per_page' => 200, // @codingStandardsIgnoreLine WordPress.VIP.SlowDBQuery.slow_db_query \r\n) );\r\n```\r\n\r\nor\r\n\r\n```php\r\n// @codingStandardsIgnoreStart WordPress.VIP.SlowDBQuery.slow_db_query\r\n$q = new WP_Query( array(\r\n    'posts_per_page' => 200,\r\n) );\r\n// @codingStandardsIgnoreEnd WordPress.VIP.SlowDBQuery.slow_db_query\r\n```\r\n\r\nThis draws inspiration from JSCS and its directives like:\r\n\r\n```js\r\n//jscs:disable requireCamelCaseOrUpperCaseIdentifiers\r\n```\r\n\r\nWe have this in the [WordPress-Coding-Standards](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards) project in a sniff-specific ad hoc system of end-of-statement comments:\r\n\r\n```php\r\necho $foo; // xss ok\r\n```\r\n\r\nWhich suppresses the `WordPress.XSS.EscapeOutput` sniff. But it would be very useful if this was standardized in PHPCS itself and available to all sniffs"},"comment":{"url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/comments/106660095","html_url":"https://github.com/squizlabs/PHP_CodeSniffer/issues/604#issuecomment-106660095","issue_url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/604","id":106660095,"user":{"login":"westonruter","id":134745,"avatar_url":"https://avatars.githubusercontent.com/u/134745?v=3","gravatar_id":"","url":"https://api.github.com/users/westonruter","html_url":"https://github.com/westonruter","followers_url":"https://api.github.com/users/westonruter/followers","following_url":"https://api.github.com/users/westonruter/following{/other_user}","gists_url":"https://api.github.com/users/westonruter/gists{/gist_id}","starred_url":"https://api.github.com/users/westonruter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/westonruter/subscriptions","organizations_url":"https://api.github.com/users/westonruter/orgs","repos_url":"https://api.github.com/users/westonruter/repos","events_url":"https://api.github.com/users/westonruter/events{/privacy}","received_events_url":"https://api.github.com/users/westonruter/received_events","type":"User","site_admin":false},"created_at":"2015-05-29T02:24:44Z","updated_at":"2015-05-29T02:24:44Z","body":"Comma-separated rules is what JSCS uses: http://jscs.info/overview.html#disabling-specific-rules\r\n\r\n```js\r\n// jscs:disable requireCurlyBraces, requireDotNotation\r\n```"}}