我是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
最佳答案
当PHPCS返回退出代码为2时,它可能有多种原因,除非您针对输出进行验证(输出到/dev/null
实际上有效地阻止了输出)
错误旁边可能是参数错误,然后您会看到用法说明。我强烈建议您检查实际输出,因为您知道已经有了退出代码2。
该 list 是通过以下方式获得的:
$ 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);
关于php - Jenkins checkstyle.xml与: 'build' exists but not 'build/logs/checkstyle. xml不匹配,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12218472/