3

I get this error in visual studio:

phpcs: The "WordPress" coding standard is not installed. Please review your configuration an try again.

In 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"

In terminal:

$ 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

What am I doing wrong?

Jamie
  • 1,909
  • 3
  • 22
  • 47

1 Answers1

0

Make sure you have cloned the git repo WPCS properly. I had the same issue and got fixed by making some changes manually to the CodeSniffer.conf

Goto C:\Users\xxx\AppData\Roaming\Composer\vendor\squizlabs\php_codesniffer\CodeSniffer.conf

Changes I've made

From:

<?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
)?>

To

 <?php
     $phpCodeSnifferConfig = array (
      'installed_path' => 'C:\\Users\\xxx\\wpcs',  // where wpcs is located
      'installed_paths' => 'C:/Users/xxx/wpcs',   // where wpcs is located
    )?>