我在 R 中使用 lintr 库来查找代码中的 linting 问题。我把它们变成这样的xml格式:
<lintsuites>
<lintissue filename="/home/.../blah.R" line_number="36" column_number="1" type="style" message="Trailing blank lines are superfluous."/>
<lintissue filename="/home/.../blahblah.R" line_number="1" column_number="8" type="style" message="Only use double-quotes."/>
</lintsuites>
现在,当出现此类问题时,我想使 Azure devops 构建失败。
我能够以这样的 JUnit 格式进行测试:
<testsuite name="MB Unit Tests" timestamp="2020-01-22 22:34:07" hostname="0000" tests="29" skipped="0" failures="0" errors="0" time="0.05">
<testcase time="0.01" classname="1_Unit_Tests" name="1_calculates_correctly"/>
<testcase time="0.01" classname="1_Unit_Tests" name="2_absorbed_correctly"/>
...
</testsuite>
当我在 azure 管道中执行此步骤时,如果测试套件中的任何测试失败,我的构建将失败:
- task: PublishTestResults@2
displayName: 'Publish Test Results'
inputs:
testResultsFiles: '**/*.xml'
searchFolder: '$(System.DefaultWorkingDirectory)/fe'
mergeTestResults: true
failTaskOnFailedTests: true
当出现 linting 问题时,我想要类似的东西来使构建失败。我还希望用户查看构建输出中的这些 linting 问题。谢谢