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

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

问题描述

我已经在我的Visual Studio Team Services构建中设置了静态代码分析.我正在为解决方案使用"MSBuild"构建步骤,并且在构建日志中,它显示以##[warning]开头的999多行:

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):警告CA2200:重新抛出捕获的异常更改堆栈信息.

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

在将"system.debug"设置为true的情况下进行构建时,我们还看到vso解析了这些警告,并且日志中的999条以上的行显示如下:

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):警告CS0109:成员'Invoice.ColumnOptions'不会隐藏可访问成员.新关键字不是必需的.
2017-11-15T12:30:40.1964968Z ## [debug]已处理:## vso [task.logissue type = Warning; sourcepath = myfilename.cs; linenumber = 28; columnnumber = 33; code = CS0109;]成员' XXX'不隐藏可访问的成员.不需要新关键字.

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.

我希望999+静态分析警告会显示在构建概述中的某个位置(即https://MYSITE.visualstudio.com/MYPROJECT/_build/index?buildId=XXX&_a=summary&tab=details).但是,它仅显示11个构建警告,仅此而已.另请参见下面的屏幕截图.如何在此构建概述中显示静态代码分析"警告?甚至可能是已触发警告类型的摘要?

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?

推荐答案

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

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

  • 代码分析警告将显示在构建摘要上
  • VSTS仅显示前11条警告
  • 因此,如果在 11个构建警告之后打印出代码分析"警告,则它们不会显示.
  • 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天全站免登陆