Jav*_*i R 1 php simplexml checkstyle
我正在使用checkstyle来验证代码的PHP项目.我有一部分代码用simplexml读取XML的问题,XML全部是大写的,例如:
$response = simplexml_load_string($xml);
$code = $response->CODE; // checkstyle won't validate this because it is in uppercase
Run Code Online (Sandbox Code Playgroud)
这段代码给了我警告,因为变量名是大写的(变量需要在camelcase中).由于这个原因,代码中有很多警告.
问题是:我可以禁用检查特定变量或整个代码区域吗?怎么样?
非常感谢你.
我不知道如何使用checkstyle,但PHPCS也可以用CheckStyle格式创建报告.因此,如果您没有使用Checkstyle,您可以切换.使用PHPCS,您可以在代码中添加伪注释以跳过检查,例如
// @codingStandardsIgnoreFile
Run Code Online (Sandbox Code Playgroud)
或只是代码的一部分
$response = simplexml_load_string($xml);
// @codingStandardsIgnoreStart
$code = $response->CODE;
// @codingStandardsIgnoreEnd
echo $code->asXml();
Run Code Online (Sandbox Code Playgroud)
另请查看http://phpqatools.org和http://jenkins-php.org/以获取其他QA工具.
| 归档时间: |
|
| 查看次数: |
1472 次 |
| 最近记录: |