JakubOnderka / PHP-Parallel-Lint

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

Force color output if it's switched on #14

Closed VasekPurchart closed 10 years ago

VasekPurchart commented 10 years ago

The library which is used by the JakubOnderka/PHP-Console-Highlighter (kevinlebrun/colors.php) is using a detection mechanism to figure out if colors are supported. The detection is using posix_isatty PHP function which evaluates if the STDOUT is an interactive terminal.

Since the lint is (I hope) supposed to be part of build tasks or it's output can be piped or redirected, then this detection evaluates the colors as not supported which does not have to be truth. All of the mentioned cases could display color control characters properly.

As mentioned above the autodetection mechanism is not working reliably in all situations and since there is an --no-color which can be used to suppress the colors anyway I propose to set force the colors when they are switched on. The coloring feature is optional anyway.

Other solution would be adding an --force-colors switch, but I guess it would make the switch options less readable.

It should probably be noted, that other tools designed to be used as part of continuous integration processes (composer, phpunit) are showing colors under these circumstances.

VasekPurchart commented 10 years ago

I rebased this PR onto PR #18, becase on current master the ouput coloring does not work anyway and this PR is still valid after #18 is merged.

VasekPurchart commented 10 years ago

I rebased this PR again after #18 was merged, so it should be ready to be merged as well.

JakubOnderka commented 10 years ago

OK, merged. Thanks.