php-parallel-lint / PHP-Parallel-Lint

This tool check syntax of PHP files faster than serial check with fancier output.
Other
282 stars 21 forks source link

Add log to file option - cannot isolate which file lint is hanging on #123

Open johnwarde opened 2 years ago

johnwarde commented 2 years ago

Currently, I do not see an option to log progress to a text file e.g. log which files have been processed.

My scenario ...

I am executing via PHAR 1.3.2 on the current folder:
C:/xampp/php/php C:\scms\parallel-lint.phar --exclude .git .

This particular local repository it is hanging for some unknown reason. This is the output ...

Xdebug: [Step Debug] Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port) :-(
PHP 7.4.29 | 10 parallel jobs
............................................................   60/1169 (5 %)
............................................................  120/1169 (10 %)
............................................................  180/1169 (15 %)
............................................................  240/1169 (20 %)
............................................................  300/1169 (25 %)
............................................................  360/1169 (30 %)
............................................................  420/1169 (35 %)
.................................X..X.......................  480/1169 (41 %)
............................................................  540/1169 (46 %)
............................................................  600/1169 (51 %)
............................................................  660/1169 (56 %)
............................................................  720/1169 (61 %)
............................................................  780/1169 (66 %)
............................................................  840/1169 (71 %)
............................................................  900/1169 (76 %)
............................................................  960/1169 (82 %)
............................................................ 1020/1169 (87 %)
............................................................ 1080/1169 (92 %)
............................................................ 1140/1169 (97 %)
..........................^C

The ^C is me hitting the Ctrl+C after I've waited minutes.

When I exclude the "application" folder within the repository, it completes ...

C:/xampp/php/php C:\scms\parallel-lint.phar --exclude application --exclude .git .
Xdebug: [Step Debug] Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port) :-(
PHP 7.4.29 | 10 parallel jobs
............................................................  60/179 (33 %)
............................................................ 120/179 (67 %)
...........................................................  179/179 (100 %)

Checked 179 files in 1.6 seconds
No syntax error found

Since the tool is multi-threaded, I assume that all but one thread completes all the other files in the repository except a single file (within the "application" folder) which a single thread stalls on. From the numbers above it will be extremely time consuming to attempt to isolate a single file amongst 990 files (1169 - 179) within the application folder using multiple --exclude parameters.

By logging progress to a file per file processed, this will help isolate the offending file. Maybe logging when a file as starting processing too?

grogy commented 2 years ago

Thanks for the report.

I agree, debugging will be demanding. Can you help me implement verbose option? General I use in CLI tools

  -v|vv|vvv       Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

It can solve your problem and it will great for everyone next