【发布时间】:2018-11-29 09:25:25
【问题描述】:
我了解如何使用 xml 配置 phpcs,但找不到如何禁用某些嗅探。这是我目前的conf(甚至不知道这是否正确):
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="custom"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd" xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
<rule ref="rulesets/codesize.xml"/>
<rule ref="rulesets/controversial.xml/Superglobals"/>
<rule ref="rulesets/controversial.xml/CamelCaseParameterName"/>
<rule ref="rulesets/controversial.xml/CamelCaseVariableName"/>
<rule ref="rulesets/design.xml"/>
<rule ref="rulesets/naming.xml/ShortMethodName"/>
<rule ref="rulesets/naming.xml/ConstructorWithNameAsEnclosingClass"/>
<rule ref="rulesets/naming.xml/ConstantNamingConventions"/>
<rule ref="rulesets/naming.xml/BooleanGetMethodName">
<properties>
<property name="checkParameterizedMethods" value="true"/>
</properties>
</rule>
<rule ref="rulesets/unusedcode.xml"/>
<arg name="tab-width" value="2"/>
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="indent" value="2"/>
</properties>
</rule>
<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="140"/>
<property name="absoluteLineLimit" value="0"/>
</properties>
</rule>
</ruleset>
我想禁用这些:
-
[phpcs] @copyright tag must contain a year and the name of the copyright holder所有文档评论嗅探(我不需要它们) [phpcs] PHP version not specified[phpcs] There must be exactly one blank line before the tags in a doc comment[phpcs] The open comment tag must be the only content on the line[phpcs] Missing short description in doc comment[phpcs] The close comment tag must be the only content on the line-
[phpcs] Line indented incorrectly; expected at least 4 spaces, found 2我用了两个空格! [phpcs] Missing file doc comment-
[phpcs] Line exceeds 85 characters; contains 91 characters我希望最多140个
如果我想添加更多,我可以在哪里搜索可能的配置?
【问题讨论】:
-
是的,非常适合命令行配置,但我想将它存储在我的 xml 中
-
Annotated ruleset Manual 可以帮忙吗?
标签: php phpcodesniffer phpcs