Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

phpcs: Unable to locate phpcs. local composer install (Windows 10) #175

Open
helgatheviking opened this issue May 13, 2020 · 1 comment
Open

Comments

@helgatheviking
Copy link

Like a lot of other people, I'm running in to the error where the plugin cannot find the path to phpcs.

The instructions say that you can do a Project-wide Installation by using composer to require -dev squizlabs/php_codesniffer

The settings for phpcs.executablePath say that you can leave it blank and it will find the file from your composer.json.

If omitted, the plugin will try to locate the path parsing your composer configuration or the global path.

But the plugin cannot seem to find that installation and to use it for linting.

phpcs: Unable to locate phpcs. Command failed: "c:\Users\helga\Local Sites\testsite\app\public\wp-content\plugins\charitable-recurring" --version '"c:\Users\helga\Local Sites\testsite\app\public\wp-content\plugins\charitable-recurring"' is not recognized as an internal or external command, operable program or batch file.

Where "charitable-recurring" is the project's root folder.

So I tried inputting the relative path as vendor\squizlabs\php_codesniffer\bin\phpcs.bat

and that at least changes the error. But "An error occurred" doesn't tell me anything.

PHP-CS-Fixer: An error occurred.

Has anyone gotten this work with a local-project installed version?

@ryentzer
Copy link

Have you tried to put in an absolute path? That was the only way I was able to get it to work on my mac.

For instance, in my settings.json I have this:

{ "phpcs.executablePath": "./vendor/bin/phpcs", "phpcs.standard": "./vendor/wptrt/WPThemeReview" }

where vendor is a folder with composer and php related files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants