PHP Code Sniffer
phpcs: Can not correctly run the tool with parameters: C:\Users\sa\AppData\Local\Temp\___0.tmp\press_home.module --encoding=utf-8 Possible tool process hangup after 5 sec. Exclude press_home.module from PHP Code Sniffer analysis.
PhpStorm throwing this message frequently. Any idea why PhpStorm showing this error?
Any idea why PhpStorm showing this error?
Extremely likely because PHP executable that is used to execute phpcs
has xdebug enabled -- execution takes longer.
Two possible solutions:
Make sure that PHP executable that is used to execute phpcs
has no xdebug enabled. E.g. you may disable xdebug altogether .. or have multiple PHP installations on your computer where default one (that will be used if you type php
in terminal) does not have xdebug.
Try increasing timeout in PhpStorm's settings (Settings/Preferences | Languages & Frameworks | PHP | Code Sniffer
). On certain systems/setups even increasing timeout to 20+ seconds (which is a lot) may still unable to resolve the issue.
Solution described in #1 is preferred from performance point of view and more reliable (but more difficult to implement, especially if you actually need xdebug locally).
Storm is notreceiving a response from sniffer or sniffer hangs. Try running it from command line with same params and see what happens, maybe you simply need an update or maybe some params are making it crash. This should go with JAVA tag as Storm is built on JAVA. Maybe JAVA devs would know more how thses command are handled. In any case this has nothing to do with php.
Increasing a timeout should only be applied when you have good reasons (complex data, remote connection etc.), but most scenarios are analyzed quickly.
Potential Solution for your problem: You are not providing a code standard as a parameter, so make sure that PHPStorm is calling phpcs with a proper coding standard, thus leaving out the --standard
parameter may cause problems.
In PHPStorm under Settings->Editor->Inspections, expand PHP and go to PHP Code Sniffer validation. There you should find a dropdown select labeled "Coding standard".
I wouldn't recommend using the default MySource as a value if you haven't got a good reason, instead select PSR2, for example.
The following command would be issued by PHPStorm, in this case:
phpcs.bat index.php --standard=PSR2 --encoding=utf-8 --report=xml