如何在基于phpcs输出的Scrutinizer上构建失败?

问题描述:

我试过配置Scrutinizer,只要CodeSniffer分析返回一些错误,但没有运气就会失败。如何在基于phpcs输出的Scrutinizer上构建失败?

这里是我试过到目前为止:

V1:

build: 
    tests: 
    override: 
     command: './vendor/bin/phpcs ./src --report=checkstyle --report-file=cs-data' 
     analysis: 
      file: 'cs-data' 
      format: 'php-cs-checkstyle' 

V2:

build: 
    tests: 
    override: 
     - 'phpcs-run' 

我的工具和build_failure_conditions

tools: 
    php_code_sniffer: 
    config: 
     standard: "PSR2" 
checks: 
    php: 
    code_rating: true 
    duplication: true 
build_failure_conditions: 
    - 'issues.label("coding-style").new.exists' 

缺少了什么?

TLDR;它看起来像你没有指定要扫描哪些文件夹的错误。

尝试使用以下:

  • scrutinizer目前不支持失败的phpcs命令(类似PHPUnit的),因为这将阻止:需要澄清我

    build: tests: override: - 'phpcs-run --standard=custom/standard/ruleset.xml --ignore=app/*/*/Test/ app/dir1/ app/dir2/ app/other/folder'

    有些事情在UI中显示的问题。

  • 解决方法是设置失败条件(您已经这样做),例如是否存在编码风格问题,那么构建失败。

我目前使用: https://scrutinizer-ci.com/docs/configuration/build_status

:如何建立故障情况

build_failure_conditions: - 'issues.label("coding-style").new.exists'

Which makes the inspection look like this

更多信息