将 Ant 与 Jenkins 一起使用,php lint 不会在无效的未更改文件上失败


Using Ant with Jenkins, php lint does not fail on invalid unchanged files

请原谅标题,因为我不知道它应该是什么。

我正在使用 Ant 为 Jenkins CI 做 php lint,并且进程缓存结果(cache.properties)。但是,如果文件没有更改,则下一次传递不会失败,但应该因为文件仍然无效。这是正常行为吗?我如何告诉它不缓存失败的文件,或者有没有其他方法可以解决这个问题?

这是我提出的解决方案(我在Windows上运行Jenkins,因此请相应地调整操作系统):

安装插件:后期构建任务(它是旧的,所以它将作为Hudson Post构建任务安装)。

配置一个名为构建后任务(插件)的构建后任务(即部分),如下所示:

日志文本:解析错误Script: del cache.properties

笨拙,但它有效。

我建议切换到另一个php linter..例如,如果您使用的是sublime text => https://packagecontrol.io/packages/SublimeLinter-phplint

我遇到了类似的问题,我所做的是从 lint 目标的文件集中删除了 <modified /> 节点。请参阅下面的示例。

这就是我面对问题时所拥有的

<target name="lint"
         unless="lint.done"
         description="Perform syntax check of sourcecode files">
  <apply executable="php" taskname="lint">
   <arg value="-l" />
   <fileset dir="${basedir}/src">
    <include name="**/*.php" />
    <modified />
   </fileset>
   <fileset dir="${basedir}/tests">
    <include name="**/*.php" />
    <modified />
   </fileset>
  </apply>
  <property name="lint.done" value="true"/>
 </target>

这就是我的 lint 目标现在的样子。

<target name="lint"
         unless="lint.done"
         description="Perform syntax check of sourcecode files">
  <apply executable="php" taskname="lint">
   <arg value="-l" />
   <fileset dir="${basedir}/src">
    <include name="**/*.php" />
   </fileset>
   <fileset dir="${basedir}/tests">
    <include name="**/*.php" />
   </fileset>
  </apply>
  <property name="lint.done" value="true"/>
 </target>

我希望这对某人有所帮助

相关文章: