You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying out GrumPHP in combination with PHPCS and PHPCompatibility. I have created a test.php file which contains code that is deprecated in PHP 7.4. When I do a git commit that includes test.php, GrumPHP will run PHPCompatibility on test.php. This seems to take forever though, and eventually the timeout is hit. When I use the following command: php vendor/bin/grumphp git:pre-commit -vvv
It gives me the following error: The process "'/<project-path>/vendor/bin/phpcs' '--standard=phpcs.xml' '--extensions=php' '--report=full' '--report-json' '--file-list=/tmp/phpDIXUnz'" exceeded the timeout of 10 seconds.
I looked at the temp file while it was running, and it only lists the test.php file. When I run the "'/<project-path>/vendor/bin/phpcs' '--standard=phpcs.xml' '--extensions=php' '--report=full' '--report-json' '--file-list=/tmp/phpDIXUnz'" command directly, it finishes in < 200ms.
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="PHPCS Coding Standards for PHPCompatibility">
<description>Check the code of the PHPCompatibility standard itself.</description>
<config name="installed_paths" value="vendor/phpcompatibility/php-compatibility"/>
<rule ref="PHPCompatibility"/>
<!-- Exclude ForbiddenNames test case code. -->
<exclude-pattern>*/PHPCompatibility/Tests/Keywords/ForbiddenNames/*\.php</exclude-pattern>
<!-- Exclude Composer vendor directory. -->
<exclude-pattern>*/vendor/*</exclude-pattern>
<!-- Only check PHP files. -->
<arg name="extensions" value="php"/>
<!-- Show progress, show the error codes for each message (source). -->
<arg value="ps"/>
<!-- Strip the filepaths down to the relevant bit. -->
<arg name="basepath" value="./"/>
<!-- Check up to 8 files simultaneously. -->
<arg name="parallel" value="8"/>
<!-- Enable caching to a fixed file. -->
<arg name="cache" value=".phpcs.cache"/>
<config name="testVersion" value="7.4-"/>
</ruleset>
Any idea why the timeout is hit when running PHPCompatibility in GrumPHP but not when I run the (apparently same) phpcs command directly?
No idea to be honest. I'm not using that specific tool myself.
You could debug the issue by changing the task to run with buffered output.
This can be done by adding a callback to the process run command. https://github.com/symfony/process/blob/5.4/Process.php#L250
That way you can see what the tool is outputting.
It might as well be running in interactive mode and asking for a question.
Another thing you could try, is to disable parallel execution and see if that is speeding up the command. This way you can rule out possible issues in amp/parallel.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
I'm trying out GrumPHP in combination with PHPCS and PHPCompatibility. I have created a test.php file which contains code that is deprecated in PHP 7.4. When I do a git commit that includes test.php, GrumPHP will run PHPCompatibility on test.php. This seems to take forever though, and eventually the timeout is hit. When I use the following command:
php vendor/bin/grumphp git:pre-commit -vvv
It gives me the following error:
The process "'/<project-path>/vendor/bin/phpcs' '--standard=phpcs.xml' '--extensions=php' '--report=full' '--report-json' '--file-list=/tmp/phpDIXUnz'" exceeded the timeout of 10 seconds.
I looked at the temp file while it was running, and it only lists the test.php file. When I run the
"'/<project-path>/vendor/bin/phpcs' '--standard=phpcs.xml' '--extensions=php' '--report=full' '--report-json' '--file-list=/tmp/phpDIXUnz'"
command directly, it finishes in < 200ms.This is my grumphp.yml:
This is my phpcs.xml file:
Any idea why the timeout is hit when running PHPCompatibility in GrumPHP but not when I run the (apparently same) phpcs command directly?
Beta Was this translation helpful? Give feedback.
All reactions