我在 visual studio 中遇到这个错误:
phpcs: The "WordPress" coding standard is not installed. Please review your configuration an try again.
在 settings.json
中:
"php.suggest.basic": true,
"php.validate.run": "onSave",
"php.validate.executablePath": "/usr/bin/php",
"phpcs.enable": true,
"phpcs.executablePath": "/Users/xxx/.composer/vendor/bin/phpcs",
"phpcs.standard": "WordPress"
在终端中:
$ which phpcs
$ /Users/xxx/.composer/vendor/bin/phpcs
$ which php
$ /usr/bin/php
$ phpcs --config-show
Using config file: /Users/xxx/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer.conf
installed_path: /Users/xxx/.composer/vendor/wp-coding-standards/wpcs
我做错了什么?
最佳答案
确保您已正确克隆 git 存储库 WPCS。我遇到了同样的问题,并通过手动对 CodeSniffer.conf
进行一些更改来解决转到 C:\Users\xxx\AppData\Roaming\Composer\vendor\squizlabs\php_codesniffer\CodeSniffer.conf
我所做的改变
来自:
<?php
$phpCodeSnifferConfig = array (
'installed_path' => 'C:\\Users\\xxx\\wpcs\\WordPress', // where wpcs is located
'installed_paths' => 'C:/Users/xxx/wpcs/WordPress', // where wpcs is located
)?>
到
<?php
$phpCodeSnifferConfig = array (
'installed_path' => 'C:\\Users\\xxx\\wpcs', // where wpcs is located
'installed_paths' => 'C:/Users/xxx/wpcs', // where wpcs is located
)?>
关于visual-studio - phpcs — Wordpress 编码标准在 Visual Studio 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60942604/
相关文章:
r - 将 ggpredict() 和 ggplot2() 与缩放的连续变量一起使用并尝试取消缩放它
angular - 如何使用 angular 在 s3 中使用带有多个文件的预签名 url
c# - TransactionScope 抛出异常 "This platform does not
macos - MAC 上 .net 核心应用程序的核心签名 + 强化运行时
encryption - 为什么使用 JSON Web Tokens (JWT) 而不是普通加密
python - tf.data 与 tf.keras.preprocessing.image.Im