我正在配置使用自定义规则集phpcs
使用WordPress 编码标准。
我的phpcs.xml
长相是这样的
<?xml version="1.0"?>
<ruleset name="Bulk Delete">
<description>Bulk Delete coding standard</description>
<file>./</file>
<!--Docs issues should be shown as warnings -->
<rule ref="WordPress-Docs">
<type>warning</type>
</rule>
</ruleset>
WordPress-Docs
是一个自定义规则集,它被定义为WordPress 编码标准嗅探的一部分,我希望将此规则集中的所有消息标记为warnings
而不是errors
.
PHP CodeSniffer wiki 中的注释规则集文件说我可以做这样的事情。
<!--
Here we are including a specific sniff but also changing
the error message of a specific message inside the sniff.
Note that the specific code for the message, which is
CommentFound in this case, is defined by the sniff developer.
You can display these codes by using the -s command line
argument when checking a file.
Also note that this message has a variable inside it,
which is why it is important that sniffs use a printf style
format for their error messages.
We also drop the severity of this message from the
default value (5) so that it is hidden by default. It can be
displayed by setting the minimum severity on the PHP_CodeSniffer
command line. This is great if you want to use some messages
only in code reviews and not have them block code commits.
-->
<rule ref="Generic.Commenting.Todo.CommentFound">
<message>Please review this TODO comment: %s</message>
<severity>3</severity>
</rule>
但这仅在您直接包括嗅探时才有效。但在我的情况下,我想让这项工作适用于使用rule
标签包含的自定义规则集。
有可能做到吗?