Jenkins checkstyle.xml并不匹配任何东西:' build'存在但不是' build / logs / checkstyle.xml

时间:2012-08-31 15:32:21

标签: php jenkins

我是詹金斯的新手所以请原谅我,如果这听起来很傻。

我似乎无法在Jenkins中运行checkstyle,我已经设置了构建文件并添加了所需信息(如下所示)但它不会接收文件。

我得到的错误是: 'build / logs / checkstyle.xml'与任何内容都不匹配:'build'存在但不存在'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>

命令行错误

phpcs:
 [exec] Result: 2

phpcs.xml文件

<?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>

报告错误:

错误 没有找到报告文件。配置错误?

更新


错误我已经解决了上述错误,现在得到以下内容:

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

1 个答案:

答案 0 :(得分:2)

当PHPCS以退出代码2返回时,它可能有很多原因,除非您对输出进行验证(输出到/dev/null有效地阻止输出[自然])

  • 错误:PHP_CodeSniffer需要PHP 5.1.2或更高版本。
  • 错误:PHP_CodeSniffer需要启用tokenizer扩展。
  • 错误:找不到.git目录(git)
  • 错误:无法执行(git,svn,hg)
  • 错误:找不到.hg目录(hg)

错误旁边可能是参数错误,然后您会看到使用说明。我强烈建议你查看实际输出,因为你知道你有退出代码2。

该列表是通过以下方式获得的:

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

导致一些稍微过时的phpcs版本(1.3.3,1.3.6现在稳定):

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);