Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins checkstyle.xml doesn't match anything: 'build' exists but not 'build/logs/checkstyle.xml

Tags:

php

jenkins

I am new to Jenkins so please forgive me if this sounds silly.

I cannot seem to get checkstyle running in Jenkins, I have set up the build file and added the required information (below) but it will not pick up the file.

The error I get is: 'build/logs/checkstyle.xml' doesn't match anything: 'build' exists but not 'build/logs/checkstyle.xml'

<target name="phpcs" description="Generate checkstyle.xml using PHP_CodeSniffer">
  <exec executable="phpcs" output="/dev/null">
   <arg value="--report=checkstyle" />
   <arg value="--report-file=${basedir}/build/logs/checkstyle.xml" />
   <arg value="--standard=${basedir}/build/phpcs.xml" />
   <arg value="--patterns=${source}/Plugin/Purifier/Vendor/" />
   <arg path="${source}" />
  </exec>
</target>

Error from Command line

phpcs:
 [exec] Result: 2

phpcs.xml File

<?xml version="1.0"?>
<ruleset name="Sebastian">
    <description>Sebastian Bergmann's coding standard</description>
    <rule ref="Generic.PHP.DisallowShortOpenTag"/>
    <rule ref="Generic.PHP.NoSilencedErrors"/>
</ruleset>

Reported Error:

Errors No report files were found. Configuration error?

UPDATE


Error I have resolved the above error and am now getting the following:

PHP Deprecated:  Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/mcrypt.ini on line 1 in Unknown on line 0
PHP Fatal error:  Maximum function nesting level of '100' reached, aborting! in /usr/share/php/PHP/CodeSniffer/File.php on line 1389
PHP Stack trace:
PHP   1. {main}() /usr/bin/phpcs:0
PHP   2. PHP_CodeSniffer_CLI->process() /usr/bin/phpcs:37
PHP   3. PHP_CodeSniffer->process() /usr/share/php/PHP/CodeSniffer/CLI.php:545
PHP   4. PHP_CodeSniffer->processFile() /usr/share/php/PHP/CodeSniffer.php:496
PHP   5. PHP_CodeSniffer->_processFile() /usr/share/php/PHP/CodeSniffer.php:1209
PHP   6. PHP_CodeSniffer_File->start() /usr/share/php/PHP/CodeSniffer.php:1331
PHP   7. PHP_CodeSniffer_File->_parse() /usr/share/php/PHP/CodeSniffer/File.php:382
PHP   8. PHP_CodeSniffer_File::tokenizeString() /usr/share/php/PHP/CodeSniffer/File.php:586
PHP   9. PHP_CodeSniffer_File::_createScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:956
PHP  10. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1344
PHP  11. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  12. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  13. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  14. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  15. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  16. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  17. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  18. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  19. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  20. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  21. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  22. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  23. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  24. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  25. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  26. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  27. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  28. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  29. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  30. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  31. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  32. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  33. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  34. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  35. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  36. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  37. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  38. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  39. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  40. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  41. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  42. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  43. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  44. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  45. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  46. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  47. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  48. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  49. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  50. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  51. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  52. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  53. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  54. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  55. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  56. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  57. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  58. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  59. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  60. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  61. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  62. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  63. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  64. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  65. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  66. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  67. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  68. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  69. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  70. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  71. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  72. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  73. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  74. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  75. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  76. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  77. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  78. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  79. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  80. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  81. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  82. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  83. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  84. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  85. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  86. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  87. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  88. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  89. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  90. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  91. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  92. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  93. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  94. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  95. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  96. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  97. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  98. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
PHP  99. PHP_CodeSniffer_File::_recurseScopeMap() /usr/share/php/PHP/CodeSniffer/File.php:1480
like image 485
ConquestXD Avatar asked Aug 31 '12 15:08

ConquestXD


1 Answers

When PHPCS returns with an exit-code of 2, it can have many reasons, unless you validate against output (outputting to /dev/null effectively prevents output [naturally])

  • ERROR: PHP_CodeSniffer requires PHP version 5.1.2 or greater.
  • ERROR: PHP_CodeSniffer requires the tokenizer extension to be enabled.
  • ERROR: Could not locate .git directory (git)
  • ERROR: Could not execute (git, svn, hg)
  • ERROR: Could not locate .hg directory (hg)

Next to an error, it can be an error with parameters, you then see the usage description. I highly suggest you check the actual output as you know you've got exit code 2.

The listing was obtained with:

$ grep -rn -B 1 'exit(2);' *

which results for some slightly outdated phpcs version (1.3.3, 1.3.6 is stable right now):

CLI.php-66-            echo 'ERROR: PHP_CodeSniffer requires PHP version 5.1.2 or greater.'.PHP_EOL;
CLI.php:67:            exit(2);
--
CLI.php-71-            echo 'ERROR: PHP_CodeSniffer requires the tokenizer extension to be enabled.'.PHP_EOL;
CLI.php:72:            exit(2);
--
CLI.php-340-                    $this->printUsage();
CLI.php:341:                    exit(2);
--
CLI.php-347-                    $this->printUsage();
CLI.php:348:                    exit(2);
--
CLI.php-389-                    echo 'ERROR: Report type "'.$report.'" not known.'.PHP_EOL;
CLI.php:390:                    exit(2);
--
CLI.php-447-            $this->printUsage();
CLI.php:448:            exit(2);
--
CLI.php-454-            $this->printUsage();
CLI.php:455:            exit(2);
--
CLI.php-499-                $this->printUsage();
CLI.php:500:                exit(2);
--
CLI.php-509-            $this->printInstalledStandards();
CLI.php:510:            exit(2);
--
Reports/Gitblame.php-105-            echo 'ERROR: Could not locate .git directory '.PHP_EOL.PHP_EOL;
Reports/Gitblame.php:106:            exit(2);
--
Reports/Gitblame.php-112-            echo 'ERROR: Could not execute "'.$command.'"'.PHP_EOL.PHP_EOL;
Reports/Gitblame.php:113:            exit(2);
--
Reports/Hgblame.php-106-            echo 'ERROR: Could not locate .hg directory '.PHP_EOL.PHP_EOL;
Reports/Hgblame.php:107:            exit(2);
--
Reports/Hgblame.php-113-            echo 'ERROR: Could not execute "'.$command.'"'.PHP_EOL.PHP_EOL;
Reports/Hgblame.php:114:            exit(2);
--
Reports/Svnblame.php-80-            echo 'ERROR: Could not execute "'.$command.'"'.PHP_EOL.PHP_EOL;
Reports/Svnblame.php:81:            exit(2);
like image 148
hakre Avatar answered Oct 26 '22 23:10

hakre