[英]Php Codesniffer Should ignore Capital letter and full stop
I'm implementing PHPCS for an existing project.我正在为现有项目实施 PHPCS。 I want to check if functions has a docblock.
我想检查函数是否有文档块。
I'm currently using the following rules:我目前正在使用以下规则:
<rule ref="Squiz.Commenting.FunctionComment" />
<rule ref="Squiz.Commenting.FunctionCommentThrowTag" />
<rule ref="Squiz.Commenting.VariableComment" />
<rule ref="Squiz.Commenting.DocCommentAlignment"/>
<rule ref="Generic.Files.LineLength">
<properties>
<property name="absoluteLineLimit" value="120"/>
<property name="lineLimit" value="120"/>
</properties>
</rule>
<!-- Ban some functions -->
<rule ref="Generic.PHP.ForbiddenFunctions">
<properties>
<property name="forbiddenFunctions" type="array">
<element key="print" value="echo"/>
<element key="var_dump" value="null"/>
<element key="dd" value="null"/>
<element key="dump" value="null"/>
<element key="echo" value="null"/>
<element key="print_r" value="null"/>
<element key="var_export" value="null"/>
</property>
</properties>
</rule>
But i get a lot of issue's that a Parameter comment should start with a capital letter and end with a fullstop.但是我遇到了很多问题,即参数注释应该以大写字母开头并以句号结尾。
How can i make the rules less strict regarding the capital letters & fullstops我怎样才能使关于大写字母和句号的规则不那么严格
Edit: Currently code block also wants to align the parameters.编辑:目前代码块也想对齐参数。 This creates a lot of ugly whitespace between
@param array
and $parameter
.这会在
@param array
和$parameter
之间创建很多难看的空格。 Can i remove this rule aswell in phpcs & phpcbf?我可以在 phpcs 和 phpcbf 中删除此规则吗?
Run PHPCS with the -s command line argument so you can see the error codes next to each message.使用 -s 命令行参数运行 PHPCS,这样您就可以在每条消息旁边看到错误代码。 Then you can exclude these specific messages in your ruleset by setting their severity to 0.
然后,您可以通过将这些特定消息的严重性设置为 0 来排除规则集中的这些特定消息。
In this specific case, you will probably want to add these 4 exclusions to your ruleset:在这种特定情况下,您可能希望将这 4 个排除项添加到您的规则集中:
<rule ref="Squiz.Commenting.FunctionComment.ParamCommentNotCapital">
<severity>0</severity>
</rule>
<rule ref="Squiz.Commenting.FunctionComment.ParamCommentFullStop">
<severity>0</severity>
</rule>
<rule ref="Squiz.Commenting.FunctionComment.SpacingAfterParamType">
<severity>0</severity>
</rule>
<rule ref="Squiz.Commenting.FunctionComment.SpacingAfterParamName">
<severity>0</severity>
</rule>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.