在 VSTS 中显示代码分析警告 [英] Show Code Analysis warnings in VSTS

查看:25
本文介绍了在 VSTS 中显示代码分析警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我的 Visual Studio Team Services 版本上

解决方案

使用 VSTS 几个月后,我的经验如下;

  • 代码分析警告将显示在构建摘要中
  • VSTS 只会显示前 11 个警告
  • 因此,如果代码分析警告在 11 个构建警告之后打印,它们将不会显示.

我们已经开始使用 构建质量检查来使构建失败与基线相比有更多警告.

I've setup Static Code Analysis on my Visual Studio Team Services builds. I'm using the "MSBuild" build step for my solution and in the build logs it shows 999+ lines that start with ##[warning]:

2017-11-09T13:52:34.7970784Z ##[warning]myfilename.cs(753,17): Warning CA2200: Re-throwing caught exception changes stack information.

When building with "system.debug" set to true, we also see that vso parses these warnings, and 999+ lines in the log show up like this:

2017-11-15T12:30:40.1964968Z ##[warning]myfilename.cs(28,33): Warning CS0109: The member 'Invoice.ColumnOptions' does not hide an accessible member. The new keyword is not required.
2017-11-15T12:30:40.1964968Z ##[debug]Processed: ##vso[task.logissue type=Warning;sourcepath=myfilename.cs;linenumber=28;columnnumber=33;code=CS0109;]The member 'XXX' does not hide an accessible member. The new keyword is not required.

I would expect that the 999+ static analysis warnings would show up somewhere in the build overview (i.e. https://MYSITE.visualstudio.com/MYPROJECT/_build/index?buildId=XXX&_a=summary&tab=details). However it only shows 11 build warnings, nothing else. See also the screenshot below. How can I display the Static Code Analysis warnings in this build overview? Maybe even a summarised overview of the types of warnings that have triggered?

解决方案

After some months of working with VSTS, my experience is as follows;

  • Code Analysis warnings will show up on the build summary
  • VSTS will only show the first 11 warnings
  • Thus, if the Code Analysis warnings are printed after 11 build warnings, they won't show up.

We've started using Build Quality Checks to fail the build when there are more warnings compared to the baseline.

这篇关于在 VSTS 中显示代码分析警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆