ikappas / vscode-phpcs

PHP CodeSniffer for Visual Studio Code
MIT License
128 stars 56 forks source link

--stdin-path option is not working: ERROR: You must supply at least one file or directory to process. #177

Open pelayog opened 4 years ago

pelayog commented 4 years ago

Using the plugin in VS, a notification appears with the following content:

phpcs: Unknown error ocurred. Please verify that C:\Users\xx\AppData\Roaming\Composer\vendor\bin\phpcs.bat --report=json -q --encoding=UTF-8 --error-severity=5 --warning-severity=5 --stdin-path=c:\path\to\file.php - returns a valid json object.

When executing this command in PowerShell, the output is the following: ERROR: You must supply at least one file or directory to process.

However, removing the --stdin option and passing the path as an argument, gives a correct output in JSON.

phpcs.bat --report=json -q --encoding=UTF-8 --error-severity=5 --warning-severity=5 c:\path\to\file.php

{"totals":{"errors":...

Any idea on how to fix it?

Thanks!

joggerjoel commented 4 years ago

PHP_CodeSniffer version 3.5.4 does not have --stdin-path

You need to clone the develop branch and alter code as stated below:

https://github.com/ikappas/vscode-phpcs/issues/119#issuecomment-395696586.