Closed CubeRanch closed 1 year ago
Interesting @CubeRanch.
My guess would be that something is going wrong with the passing of input to PHPCS on Windows. I don't really have a convenient way to replicate this. I use WSL2 whenever I'm developing on Windows.
This issue highlights to me a need for integration tests that run PHPCS against dummy files and validates the parsed reports. We can then use a GitHub Workflow to run them against Windows, macOS, and Ubuntu. That would make issues here very obvious and let us deepens platform support.
I'm sorry that I can't be more help! I'll try to write these tests within the next few weeks and then hopefully solve this issue. We are going to be welcoming our second child this weekend and I'll be a little busy 🙂
No worries.
Priorities, man. Congratulations.
If there's anything I can test for you, let me know.
Thanks @CubeRanch, I don't think there is! I poked a bit at the Node documentation and it looks like using spawn
on batch file has interesting complications. There's a good chance the solution will be spawning the worker a little differently on Windows.
Feel free to submit a PR if you want to take a swing at writing some integration tests or trying to solve it. This is an open source project after all :)
Hi @CubeRanch,
I just wanted to let you know that I've released a new version resolving bugs with running PHPCS natively in Windows. You should no longer experience any problems.
Description
Using PHP_CodeSniffer on Windows.
phpcs is installed globally by Composer in: C:\Users\User\AppData\Roaming\Composer\vendor\bin\phpcs
The C:\Users\User\AppData\Roaming\Composer\vendor\bin directory is in my PATH.
Running phpcs --version in VS Code's terminal returns: PHP_CodeSniffer version 3.7.1 (stable) by Squiz (http://www.squiz.net)
That path, with the .bat extension added to phpcs, is in the GUI Settings field: PHP Code Sniffer: Executable PHP Code Sniffer: Lint Action is set to "Change".
Making a change in a PHP document, or calling Format Document outputs this: "[2022-8-3 22:3624]: ERROR: You must supply at least one file or directory to process.
Run "phpcs --help" for usage information"
Also, a PHP_CodeSniffer message pops up: "The PHPCS worker encountered an error."
Reproduction Steps
Expected Behavior
The file linted and formatted.
Any idea what's going on?
Regards