简体   繁体   English

自定义PHP_CodeSniffer(CodeSniffer)标准

[英]Custom PHP_CodeSniffer (CodeSniffer) Standards

I seem to be having trouble providing the installed_paths configurable. 我似乎无法提供可配置的installed_pa​​ths It seems to sabotage phpcs . 看来是在破坏phpcs

Show installed standards: 显示已安装的标准:

$ sudo /usr/bin/phpcs -i
The installed coding standards are PSR2, PHPCS, PEAR, PSR1, Squiz, MySource, Zend, CakePHP, PSR2, PHPCS, PEAR, PSR1, Squiz, MySource, Zend and CakePHP

Show default installed_paths value: 显示默认的installed_pa​​ths值:

$ sudo /usr/bin/phpcs --config-show
Array
(
    [installed_paths] => /usr/share/php/PHP/CodeSniffer/Standards
)

If I pass the default installed_paths value explicitly in with --config-set, it no longer shows any installed standards: 如果我与--config设定明确地传递默认值installed_pa​​ths,它不再显示任何已安装的标准:

$ sudo /usr/bin/phpcs --config-set installed_paths /usr/share/php/PHP/CodeSniffer/Standards -i
$

I have the latest stable version of PHP_CodeSniffer (1.5.4), and it looks like they added this in 1.5.1. 我有最新的稳定版本PHP_CodeSniffer (1.5.4),看起来他们在1.5.1中添加了此版本。 Has anyone had success? 有人成功吗?

As @GregSherwood mentioned in the comment, the correct parameter is --runtime-set . 正如@GregSherwood在评论中提到的,正确的参数是--runtime-set --config-set updates the config file and exits immediately. --config-set更新配置文件并立即退出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM