fnando / vscode-linter

Extension for code linting, all in one package. New linters can be easily added through an extension framework.
https://marketplace.visualstudio.com/items?itemName=fnando.linter
MIT License
63 stars 16 forks source link

PHPCS: Searched for shim - couldn't be found within $PATH #34

Open oojacoboo opened 1 year ago

oojacoboo commented 1 year ago

PHPCS Version: 3.7.2 (stable)

Searched for any of /Users/jacob/.vscode-insiders/extensions/fnando.linter-0.0.19/shims/phpcs-shim; couldn't be found within $PATH

It then goes on to print my $PATH, which includes all the proper paths, including the one to the phpcs script.

It's worth mentioning that I don't think this error message is particularly helpful or accurate.

I tried debugged the phpcs-shim. I get an exit code of 127 from the phpcs call.

I then tried replicating the command using phpcs directly. However, I discovered that it's hanging with using STDIN. Passing the file as the last argument seems to work, without using STDIN, using phpcs directly.

phpcs --report=json --standard=/path/to/phpcs.xml /path/to/file.php -q

I then tried modifying the /Users/jacob/.vscode-insiders/extensions/fnando.linter-0.0.19/shims/phpcs-shim arguments to match the successful command from phpcs. I'm able to get the command array to print what seems to be the correct arguments, but I suspect the shim isn't written to handle the file being at the end of the command, without a flag.

  "command": [
    "/Users/jacob/.vscode-insiders/extensions/fnando.linter-0.0.19/shims/phpcs-shim",
    "--report",
    "json",
    "--standard",
    "/path/to/phpcs.xml",
    "/path/to/file.php",
    "-q"
  ]

At this point, maybe that shim can be rewritten to process the /path/to/file.php without a flag. But, I don't want to go down that path if there is something else going on here that I'm overlooking.

Any ideas?

z0mbieparade commented 1 year ago

Getting the same error, any more info on this?