PHPCS针对不同目录的不同规则集
发布时间:2020-12-13 22:26:22 所属栏目:PHP教程 来源:网络整理
导读:我目前正在努力清理现有的代码库,其中一个方面涉及使用 PHPCS.这是我目前的phpcs.xml文件: ?xml version='1.0'?ruleset name='MyApplication' arg name='encoding' value='utf-8'/ arg name='extensions' value='php'/ arg name='warning-severity' value='
我目前正在努力清理现有的代码库,其中一个方面涉及使用
PHPCS.这是我目前的phpcs.xml文件:
<?xml version='1.0'?> <ruleset name='MyApplication'> <arg name='encoding' value='utf-8'/> <arg name='extensions' value='php'/> <arg name='warning-severity' value='0'/> <arg name='colors'/> <arg value='p'/> <exclude-pattern>vendor/*</exclude-pattern> <exclude-pattern>node_modules/*</exclude-pattern> <rule ref='PSR1'></rule> </ruleset> 我想修改它,以便将PSR-2应用于某些目录(例如foo /和bar /),同时根据PSR-1检查剩余的目录. 我找到了< exclude-pattern>手册中的选项可以作为< rule>的子元素放置元素,但我需要相反的. 解决方法
创建多个配置并使用–standard选项加载它们:
vendor/bin/phpcs source-to-check --standard first-settings.xml vendor/bin/phpcs another-to-check --standard second-settings.xml (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |