Jul*_*ian 5 php ant hudson codesniffer jenkins
我正在使用Jenkins(Hudson)CI,每天晚上使用一些工具来分析代码,包括用于Checkstyle报告的Codesniffer.我不想忽略该./framework/*目录,但它坚持包含它,无论我对--ignore参数的努力如何.
该报告已成功创建和解析,但由于框架中违反Pear Coding标准的情况极为严重,因此对我们没有任何用处.
代码是从我的Ant构建脚本调用的,如下所示:
<target name="phpcs-ci" description="Find coding standard violations using PHP_CodeSniffer creating a log file for the continuous integration server">
<exec executable="phpcs" dir="${basedir}" output="${basedir}/build/logs/checkstyle.xml" failonerror="off">
<arg line="--report=checkstyle --standard=${basedir}/build/phpcs.xml --extensions=php --ignore=*/framework/* ${basedir}" />
</exec>
</target>
Run Code Online (Sandbox Code Playgroud)
我已经尝试了--ignore=framework,--ignore=framework/以及上面的那一行,都来自我在网络上发现的例子.
我也试过为每个参数(using < arg value"..." />)使用不同的行,但无济于事.
有任何想法吗?非常感激 :)
编辑:--ignore参数现在是:
--ignore=${basedir}/framework/
Run Code Online (Sandbox Code Playgroud)
......但仍然包含框架文件夹.有没有人有一个工作的PhpCodeSniffer配置,带有--ignore参数,有效吗?
在这里交叉手指
小智 7
我在詹金斯遇到同样的问题,上面的回答在一定程度上帮助了我.这就是我现在拥有的(并在我的系统上工作).
如果您的系统如下所示:
/
/build.xml
/foo
/foo/bar
Run Code Online (Sandbox Code Playgroud)
这就是我在build.xml中的内容
<target name="phpcs" description="Find coding standard violations using PHP_CodeSniffer and print human readable output. Intended for usage on the command line before committing.">
<exec executable="phpcs">
<arg value="--standard=${basedir}/build/phpcs.xml" />
<arg value="--ignore=foo/bar" />
<arg path="${basedir}" />
</exec>
Run Code Online (Sandbox Code Playgroud)
诀窍是不使用$ {basedir}并丢失目录的尾部斜杠.
我希望它有所帮助
也可以将这些排除项放在 build/phpcs.xml 中。在詹金斯这里工作得很好。
排除 js/facebook 目录中的所有文件、js/jquery* 的通配符匹配和指定文件名的示例。
<exclude-pattern>lib/facebook</exclude-pattern>
<exclude-pattern>js/jquery*</exclude-pattern>
<exclude-pattern>lib/Postmark.php</exclude-pattern>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7168 次 |
| 最近记录: |