Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/jenkins/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Jenkins和Php代码嗅探器_Php_Jenkins_Checkstyle_Codesniffer - Fatal编程技术网

使用Jenkins和Php代码嗅探器

使用Jenkins和Php代码嗅探器,php,jenkins,checkstyle,codesniffer,Php,Jenkins,Checkstyle,Codesniffer,我试图在Jenkins中使用Php代码嗅探器插件。 它生成一个checkstyle.xml文件,但里面没有错误,我知道我应该这样做 以下是我的checkstyle.xml的内容: <?xml version="1.0" encoding="UTF-8"?> <checkstyle version="1.5.0RC2"> </checkstyle> 它生成相同的checkstyle.xml,没有错误,并生成包含错误的phpcs-checkstyle.tmp 如

我试图在Jenkins中使用Php代码嗅探器插件。 它生成一个checkstyle.xml文件,但里面没有错误,我知道我应该这样做

以下是我的checkstyle.xml的内容:

<?xml version="1.0" encoding="UTF-8"?>
<checkstyle version="1.5.0RC2">
</checkstyle>
它生成相同的checkstyle.xml,没有错误,并生成包含错误的phpcs-checkstyle.tmp

如何才能在checkstyle.xml文件中获得包含错误的结果


谢谢。

我相信在Jenkins(ant)中运行命令时出现问题的原因是因为您使用了通配符星号。通配符由linux shell扩展,但不是由ant扩展

尝试删除通配符

<target name="phpcs" >
  <exec executable="phpcs">
    <arg line="--report=checkstyle 
      --report-file=${project.basedir}/build/logs/checkstyle.xml
      --standard=Zend
      ${project.basedir}" />
  </exec>
</target>



不过,默认情况下,phpcs只检查.inc和.php文件。

我认为您的问题在于您正遭受此错误的困扰:

该错误仅出现在您正在使用的RC版本中


恢复到当前的稳定版本(1.4.5)应该会让您的工作重新开始。

谢谢Jay Klehr,我以前尝试过这个,但当我启动一个版本时,phpcs版本并没有结束。它似乎在做什么,但我不知道是什么。(我只有2个php文件来检查我的测试)。我让它运行15分钟,但我不认为这是正常的。我还需要做其他事情吗?现在设置--extensions=php,它就可以工作了。我做了太多的改变,我不知道我是否改变了一些没有改变的东西。顺便说一句,谢谢。谢谢你,格雷格,是的,似乎也是同样的问题。我是Linux的新手,如何降低版本?你能给我看一下命令行吗?没关系,我知道怎么做了。这一代人似乎在工作,我必须检查一下。非常感谢。
phpcs --report=checkstyle --report-file=checkstyle.xml --standard=Zend *.php
<target name="phpcs" >
  <exec executable="phpcs">
    <arg line="--report=checkstyle 
      --report-file=${project.basedir}/build/logs/checkstyle.xml
      --standard=Zend
      ${project.basedir}" />
  </exec>
</target>
<target name="phpcs" >
  <exec executable="phpcs">
    <arg line="--report=checkstyle 
      --report-file=${project.basedir}/build/logs/checkstyle.xml
      --standard=Zend
      --extensions=php
      ${project.basedir}" />
  </exec>
</target>