wongjn / vscode-php-sniffer

Visual Studio Code extension for PHP_Codesniffer validation and formatting.
https://marketplace.visualstudio.com/items?itemName=wongjn.php-sniffer
MIT License
46 stars 7 forks source link

Error massage: spawn ENOTDIR #44

Closed jefiedler closed 3 years ago

jefiedler commented 3 years ago

Hey, I set the executablesFolder in the settings as relative path or as path and get the error message spawn ENTODIR.

Steps to reproduce the behavior:

  1. Set Executables folder to: /Users/jonaseliasfiedler/dev/subfolder/workspace-folder/cake/framework/Vendor/bin/phpcs
  2. Set the Sniff standard to: /Users/jonaseliasfiedler/dev/subfolder/workspace-folder/phpcs.xml.dist
  3. Opened a file from the project and saved it.
  4. See the error spawn ENTODIR Screenshot 2020-11-22 at 11 59 16

Expected behavior The file is scanned and the errors and warnings are displayed.

Environment

Extension settings

{
    "phpSniffer.executablesFolder": "/Users/jonaseliasfiedler/dev/subfolder/workspace-folder/cake/framework/Vendor/bin/phpcs",
    "phpSniffer.autoDetect": true,
    "phpSniffer.standard": "/Users/jonaseliasfiedler/dev/subfolder/workspace-folder/phpcs.xml.dist"
}

Additional context I would be very grateful if there is a solution. I have been trying to solve the whole thing for 4 days. My hope is, that I can use your extension. Otherwise I will have to switch to SublimeText, which I don't want to do. Since I love VSCode. I also felt that your extension is the only one that is still being developed and supported for phpcs for VSCode.

wongjn commented 3 years ago

Thank you for the bug report. It looks like it is a misconfiguration with regards to the phpSniffer.executablesFolder setting. As per the README: "The folder where both phpcs and phpcbf executables are", so for your use case, the correct settings would be:

 {
-    "phpSniffer.executablesFolder": "/Users/jonaseliasfiedler/dev/subfolder/workspace-folder/cake/framework/Vendor/bin/phpcs",
+    "phpSniffer.executablesFolder": "/Users/jonaseliasfiedler/dev/subfolder/workspace-folder/cake/framework/Vendor/bin/",
     "phpSniffer.autoDetect": true,
     "phpSniffer.standard": "/Users/jonaseliasfiedler/dev/subfolder/workspace-folder/phpcs.xml.dist"
 }
jefiedler commented 3 years ago

Thanks for the quick help. Now I don't get the error anymore. But nothing is scanned after I save the file. Maybe it is also because of the workspace I have, or cakePHP... Thanks anyway.