如何解决PHPCS 向规则集添加 php 语法错误检查
更新
我有太多的格式错误,以至于一个解析/语法错误都丢失了。
有没有办法突出显示语法错误,以便立即看到?
原创
我制定了这个到目前为止有效的规则集。当试图让 phpcs 检查简单的 php 语法错误时,我将 <rule ref="Generic.PHP.Syntax"/>
添加到规则集。我还在其中一个文件中添加了一个语法错误,但没有报告任何内容。
我使用 Github Action 来运行 linter:
wearerequired/lint-action@v1
配置如下:
- name: Run linters
uses: wearerequired/lint-action@v1
with:
php_codesniffer: true
php_codesniffer_args: "-n"
我需要添加不同的语法规则吗?
<ruleset name="MyStandard">
<description>My custom coding standard.</description>
<exclude-pattern>*/libraries/*</exclude-pattern>
<rule ref="PEAR">
<exclude name="PEAR.NamingConventions.ValidFunctionName"/>
<exclude name="PEAR.NamingConventions.ValidVariableName"/>
<exclude name="PEAR.Commenting.ClassComment"/>
<exclude name="Generic.Commenting.DocComment.MissingShort"/>
<exclude name="PEAR.Commenting.ClassComment.Missing"/>
<exclude name="PEAR.Commenting.FileComment.Missing"/>
<exclude name="PEAR.Commenting.FunctionComment.Missing"/>
<exclude name="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket"/>
<exclude name="PEAR.Functions.FunctionCallSignature.CloseBracketLine"/>
<exclude name="PEAR.NamingConventions.ValidFunctionName.PrivateNoUnderscore"/>
<exclude name="PEAR.Commenting.FileComment.MissingCategoryTag"/>
<exclude name="PEAR.Commenting.FileComment.MissingPackageTag"/>
<exclude name="PEAR.Commenting.FileComment.MissingLinkTag"/>
<exclude name="PEAR.Commenting.FileComment.MissingVersion"/>
<exclude name="PEAR.Commenting.InlineComment"/>
<exclude name="PEAR.WhiteSpace.ScopeIndent.IncorrectExact"/>
<exclude name="Generic.WhiteSpace.DisallowTabIndent.TabsUsed"/>
</rule>
<rule ref="Generic.PHP.Syntax"/>
</ruleset>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。