Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/16.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
Continuous integration 使用Checkstyle报告可视化PHP代码(来自CodeSniffer)_Continuous Integration_Checkstyle_Codesniffer - Fatal编程技术网

Continuous integration 使用Checkstyle报告可视化PHP代码(来自CodeSniffer)

Continuous integration 使用Checkstyle报告可视化PHP代码(来自CodeSniffer),continuous-integration,checkstyle,codesniffer,Continuous Integration,Checkstyle,Codesniffer,PHP CodeSniffer是一个非常好的工具,可以帮助我们检查PHP源代码。但是CodeSniffer的报告并不容易阅读 我发现CodeSniffer可以输出“Checkstyle”xml报告。这是使用Checkstyle xml报表可视化PHP代码的方法吗,这样每个开发人员都可以在一个页面中阅读代码和报表 事实上,我发现了一个名为phpUnderControl的工具,它看起来像是一个非常好的持续集成工具,其中的一些东西可以满足我的需求。但是我没有计划改变我的持续集成工具(我正在使用Apac

PHP CodeSniffer是一个非常好的工具,可以帮助我们检查PHP源代码。但是CodeSniffer的报告并不容易阅读

我发现CodeSniffer可以输出“Checkstyle”xml报告。这是使用Checkstyle xml报表可视化PHP代码的方法吗,这样每个开发人员都可以在一个页面中阅读代码和报表

事实上,我发现了一个名为phpUnderControl的工具,它看起来像是一个非常好的持续集成工具,其中的一些东西可以满足我的需求。但是我没有计划改变我的持续集成工具(我正在使用ApacheContinuum)

因此,如果有人能告诉我一个简单的工具或插件,那将是最好的


谢谢。

这实际上更多的是一个评论/问题,但SO认为它太长了,所以我将把它作为一个答案:

假设您希望这样获取输出:

$ phpcs --report=checkstyle /path/to/code

<?xml version="1.0" encoding="UTF-8"?>
<checkstyle version="1.0.0">
 <file name="/path/to/code/myfile.php">
  <error line="2" column="1" severity="error" message="Missing file doc comment" source="PEAR.Commenting.FileComment"/>
  <error line="20" column="43" severity="error" message="PHP keywords must be lowercase; expected &quot;false&quot; but found &quot;FALSE&quot;" source="Generic.PHP.LowerCaseConstant"/>
  <error line="47" column="1" severity="error" message="Line not indented correctly; expected 4 spaces but found 1" source="PEAR.WhiteSpace.ScopeIndent"/>
  <error line="47" column="20" severity="warning" message="Equals sign not aligned with surrounding assignments" source="Generic.Formatting.MultipleStatementAlignment"/>
  <error line="51" column="4" severity="error" message="Missing function doc comment" source="PEAR.Commenting.FunctionComment"/>
 </file>
</checkstyle>
$phpcs--report=checkstyle/path/to/code
并呈现一个版本的原始源代码,并以某种方式突出显示指定的部分,然后我认为您将不得不“滚动您自己的”

您必须编写一个脚本,该脚本将代码存储库中源文件的路径作为输入参数(例如path/to/code),将“checkstyle”XML块作为输入(通过STDIN),并将文件的内容(到STDOUT)呈现为HTML标记

内部文件的主体应该位于PRE元素中(以保留格式),每个指定的行+列(带有指向错误/警告“list element”的HREF链接)将位于HTML页面的底部(我不确定PRE元素中可以使用哪种添加颜色/突出显示)

这是一个好主意-我希望自己拥有这样一个脚本/工具/实用工具!如果我有时间写一篇,我保证会在Github上发布,并在这里添加链接


如果你找到/写了一个,请回答你自己的问题,好吗?

这实际上更多的是一个评论/问题,但SO认为它太长了,所以我将把它作为一个答案:

假设您希望这样获取输出:

$ phpcs --report=checkstyle /path/to/code

<?xml version="1.0" encoding="UTF-8"?>
<checkstyle version="1.0.0">
 <file name="/path/to/code/myfile.php">
  <error line="2" column="1" severity="error" message="Missing file doc comment" source="PEAR.Commenting.FileComment"/>
  <error line="20" column="43" severity="error" message="PHP keywords must be lowercase; expected &quot;false&quot; but found &quot;FALSE&quot;" source="Generic.PHP.LowerCaseConstant"/>
  <error line="47" column="1" severity="error" message="Line not indented correctly; expected 4 spaces but found 1" source="PEAR.WhiteSpace.ScopeIndent"/>
  <error line="47" column="20" severity="warning" message="Equals sign not aligned with surrounding assignments" source="Generic.Formatting.MultipleStatementAlignment"/>
  <error line="51" column="4" severity="error" message="Missing function doc comment" source="PEAR.Commenting.FunctionComment"/>
 </file>
</checkstyle>
$phpcs--report=checkstyle/path/to/code
并呈现一个版本的原始源代码,并以某种方式突出显示指定的部分,然后我认为您将不得不“滚动您自己的”

您必须编写一个脚本,该脚本将代码存储库中源文件的路径作为输入参数(例如path/to/code),将“checkstyle”XML块作为输入(通过STDIN),并将文件的内容(到STDOUT)呈现为HTML标记

内部文件的主体应该位于PRE元素中(以保留格式),每个指定的行+列(带有指向错误/警告“list element”的HREF链接)将位于HTML页面的底部(我不确定PRE元素中可以使用哪种添加颜色/突出显示)

这是一个好主意-我希望自己拥有这样一个脚本/工具/实用工具!如果我有时间写一篇,我保证会在Github上发布,并在这里添加链接

如果你曾经找到/写过一个,请回答你自己的问题,好吗?

那么,你是否最终在这里“推出了你自己的”解决方案?Checkstyle有一个Bambol(Atlassian)插件,但它只执行您已经介绍过的部分(使用Apache Continuum)。一个简单的Google搜索并没有显示任何东西,它只是将源文件和Checkstyle报告作为输入,并生成源文件的“标记”版本作为输出。如果写得好的话,我会自己付钱买这样一个工具。那么,你是不是最终“推出了自己的”解决方案?Checkstyle有一个Bambol(Atlassian)插件,但它只执行您已经介绍过的部分(使用Apache Continuum)。一个简单的Google搜索并没有显示任何东西,它只是将源文件和Checkstyle报告作为输入,并生成源文件的“标记”版本作为输出。如果写得好的话,我会自己付钱买这样一个工具。