Details
Description
Currently, when debug output is not enabled, we only get the return code of php executable when something goes wrong. For example:
[INFO] Executing PHPCodeSniffer with command 'phpcs --report-file=/home/s27697/.hudson/jobs/GEC_TestPHP/workspace/target/logs/codesniffer.xml --report=checkstyle --standard=/home/s27697/.hudson/jobs/GEC_TestPHP/workspace/target/logs/ruleset3563104260756670494.xml --extensions=php,php3,php4,php5,phtml,inc /home/s27697/.hudson/jobs/GEC_TestPHP/workspace/src/main/php' [INFO] PHPCodeSniffer ended with returned code '255'.
Also the process is not stopped when the return code is bad, but will likely fail later and that make understanding of the error difficult.
When enabling debug output (-X with Maven) we can see the real error cause but this is very verbose. For example:
[INFO] Executing PHPCodeSniffer with command 'phpcs --report-file=/home/s27697/.hudson/jobs/GEC_TestPHP/workspace/target/logs/codesniffer.xml --report=checkstyle --standard=/home/s27697/.hudson/jobs/GEC_TestPHP/workspace/target/logs/ruleset6901610168221238437.xml --extensions=php,php3,php4,php5,phtml,inc /home/s27697/.hudson/jobs/GEC_TestPHP/workspace/src/main/php'
[DEBUG]
[DEBUG] Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 72 bytes) in /usr/share/php/PHP/CodeSniffer.php on line 1392
[DEBUG]
[DEBUG] Call Stack:
[DEBUG] 0.0003 120472 1. {main}() /usr/bin/phpcs:0
[DEBUG] 0.0338 2036448 2. PHP_CodeSniffer_CLI->process() /usr/bin/phpcs:38
[DEBUG] 0.0344 2051520 3. PHP_CodeSniffer->process() /usr/share/php/PHP/CodeSniffer/CLI.php:542
[DEBUG] 1.3095 10218648 4. PHP_CodeSniffer->processFile() /usr/share/php/PHP/CodeSniffer.php:484
[DEBUG] 1.3096 10218648 5. PHP_CodeSniffer->_processFile() /usr/share/php/PHP/CodeSniffer.php:1132
[DEBUG] 1.3097 10219184 6. PHP_CodeSniffer_File->start() /usr/share/php/PHP/CodeSniffer.php:1252
[DEBUG] 1.3097 10219184 7. PHP_CodeSniffer_File->_parse() /usr/share/php/PHP/CodeSniffer/File.php:383
[DEBUG] 1.3099 10290528 8. PHP_CodeSniffer_File::tokenizeString() /usr/share/php/PHP/CodeSniffer/File.php:587
[DEBUG] 1.3099 10290528 9. PHP_CodeSniffer_Tokenizers_PHP->tokenizeString() /usr/share/php/PHP/CodeSniffer/File.php:951
[DEBUG] 1.5315 33547320 10. PHP_CodeSniffer::standardiseToken() /usr/share/php/PHP/CodeSniffer/Tokenizers/PHP.php:384
[DEBUG]
[INFO] PHPCodeSniffer ended with returned code '255'.
What I am expecting is the following log when debug mode is not enabled:
[INFO] Executing PHPCodeSniffer with command 'phpcs --report-file=/home/s27697/.hudson/jobs/GEC_TestPHP/workspace/target/logs/codesniffer.xml --report=checkstyle --standard=/home/s27697/.hudson/jobs/GEC_TestPHP/workspace/target/logs/ruleset3563104260756670494.xml --extensions=php,php3,php4,php5,phtml,inc /home/s27697/.hudson/jobs/GEC_TestPHP/workspace/src/main/php' [ERROR] Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 72 bytes) in /usr/share/php/PHP/CodeSniffer.php on line 1392 [ERROR] PHPCodeSniffer ended with returned code '255'.
Then build fail at this point.
I don't know if it could be implemented by a generic way or if a parsing of the output of each tool is required.
Issue Links
- depends upon
-
SONAR-2969
Improve CommandExecutor to execute and test the exit code
-
Activity
Fabrice Bellingard
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Link | This issue depends upon SONAR-2969 [ SONAR-2969 ] |
Fabrice Bellingard
made changes -
| Assignee | Akram Ben Aissi [ akram ] | Fabrice Bellingard [ fabemn ] |
Fabrice Bellingard
made changes -
| Fix Version/s | PHP-0.7 [ 17854 ] |
Fabrice Bellingard
made changes -
| Original Estimate | 0 minutes [ 0 ] | |
| Remaining Estimate | 0 minutes [ 0 ] |
Fabrice Bellingard
made changes -
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Resolution | Fixed [ 1 ] |
Fabrice Bellingard
made changes -
| Status | Resolved [ 5 ] | Closed [ 6 ] |
This is actually output of PHP... including call stack