0

更新

我有太多格式错误,以至于一个解析/语法错误就丢失了。

有没有办法突出语法错误,以便立即看到它们?


原来的

我制定了迄今为止有效的规则集。当试图让 phpcs 检查我添加<rule ref="Generic.PHP.Syntax"/>到规则集中的简单 php 语法错误时。我还向其中一个文件添加了语法错误,但没有报告任何内容。

我使用 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>
4

0 回答 0