Open pento opened 5 years ago
In that case, either a better way to identify files with template tags needs to be determined or the file could be excluded for that error message with a ruleset exclusion in the Core ruleset:
<rule ref="WordPress.Files.FileName.InvalidTemplateTagFileName">
<exclude-pattern>src/wp-includes/template\.php$</exclude-pattern>
</rule>
In that case, unless someone comes up with a better way for us to determine that a file contains template tags, there is nothing more we can do here.
In that case, unless someone comes up with a better way for us to determine that a file contains template tags, there is nothing more we can do here.
Seeing that detecting the @subpackage doctag is (going to be) deprecated this issue should probably be renamed to something like Create new method of detecting WordPress.Files.FileName.InvalidTemplateTagFileName
.
@NielsdeBlaauw Good point, but the PSR 5 & doc handbook both note in favor of a unified package tag: @package Package\Subpackage
, so I would expect that once that comes into play, all we'd need to do would be to change the sniff to look at the (end of) the value for the @package
instead of the @subpackage
tag to solve that.
Bug Description
The
WordPress.Files.FileName.InvalidTemplateTagFileName
sniff incorrectly throws an error onsrc/wp-includes/template.php
. This file is part of theTemplate
subpackage, but doesn't contain template tags.https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/blob/e73a10e1c12ce07a12c3a8756efc54701458d23b/WordPress/Sniffs/Files/FileNameSniff.php#L213-L242
Minimal Code Snippet
For bugs with fixers: How was the code fixed? How did you expect the code to be fixed?
Error Code
WordPress.Files.FileName.InvalidTemplateTagFileName
Environment
Tested Against
develop
branch?develop
branch of WPCS.