0

我試過配置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' 

缺少了什麼?

回答

0

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

更多信息