{"action":"created","issue":{"url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/470","labels_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/470/labels{/name}","comments_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/470/comments","events_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/470/events","html_url":"https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/470","id":109876024,"number":470,"title":"WordPress.Files.FileName.UnderscoresNotAllowed and the template hierarchy","user":{"login":"mboynes","id":465154,"avatar_url":"https://avatars.githubusercontent.com/u/465154?v=3","gravatar_id":"","url":"https://api.github.com/users/mboynes","html_url":"https://github.com/mboynes","followers_url":"https://api.github.com/users/mboynes/followers","following_url":"https://api.github.com/users/mboynes/following{/other_user}","gists_url":"https://api.github.com/users/mboynes/gists{/gist_id}","starred_url":"https://api.github.com/users/mboynes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mboynes/subscriptions","organizations_url":"https://api.github.com/users/mboynes/orgs","repos_url":"https://api.github.com/users/mboynes/repos","events_url":"https://api.github.com/users/mboynes/events{/privacy}","received_events_url":"https://api.github.com/users/mboynes/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-05T20:10:08Z","updated_at":"2015-10-05T20:19:01Z","closed_at":null,"body":"Currently, this standard will throw an error if a file is encountered whose filename contains an underscore:\r\n\r\n```\r\n 1 | ERROR | [ ] Filename \"taxonomy-post_format-post-format-link.php\"\r\n   |       |     with underscores found; use\r\n   |       |     taxonomy-post-format-post-format-link.php instead\r\n   |       |     (WordPress.Files.FileName.UnderscoresNotAllowed)\r\n```\r\n\r\nTechnically, this is correct. The [WordPress coding standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/) states that \"hyphens should separate words\" in file names. However, this may conflict with the [template hierarchy's requirements](https://developer.wordpress.org/themes/basics/template-hierarchy/), which use post types and taxonomies (as well as page/post slugs, author nicenames, mime types, and more) as part of the file name. For instance, from the docs on the template hierarchy,\r\n\r\n> In the case of post formats, the taxonomy is ‘post_format’ and the terms are ‘post-format-{format}. i.e. taxonomy-post_format-post-format-link.php for the link post format.\r\n\r\nTherefore, the file _unavoidably_ named `taxonomy-post_format-post-format-link.php` will throw an error as in the example above. I understand that exclusions can be added to the ruleset, but I think the question should still be raised: **Should template hierarchy files be excepted from this sniff?**"},"comment":{"url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/comments/145655347","html_url":"https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/470#issuecomment-145655347","issue_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/470","id":145655347,"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},"created_at":"2015-10-05T20:19:01Z","updated_at":"2015-10-05T20:19:01Z","body":"Is it possible to craft a general set of exclusions that can reliably detect template files?"}}