Skip to content

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

Open

Description

@helgatheviking

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?

Activity

  1. ryentzer commented on Aug 10, 2020

    @ryentzer

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions