【发布时间】:2015-03-17 15:06:20
【问题描述】:
我正在尝试在一些 ASP.Net 应用程序上使用 Sonar。 我已经安装了 Sonar 并配置了 C# 环境,并且可以正常工作...除了 FXcop(代码分析)。
- sonar-runner.bat 没问题
- FXCop 路径配置良好
- Sonnar-runner 正确启动 FXcop (12.0)
- FXCop 在项目的.sonar 目录下构建“fxcop-report.xml”
- 此文件包含一些我应该在 Sonarqube 中看到的“问题”
- FXCop 退出,代码为 1024,声纳运行器似乎没问题
- sonar-runner 执行似乎一直都很好:“ANALYSIS SUCCESSFUL”... 然后“EXECUTION SUCCESS”
我的默认质量规则“仅”是 FXCop 的。
但是当我连接到 sonarqube 时,我的项目默认设置为“0”。 我的意思是,我真的希望有 0 个默认值,但这不是现实。
我一直在搜索,我在官方论坛上看到说报告中的问题元素应该具有“路径”和“文件”属性才能使其正常工作,我就是这种情况:
<Member Name="#TypeDeclar()" Kind="Method" Static="False" Accessibility="Private" ExternallyVisible="False">
<Messages>
<Message TypeName="Dispose objects before losing scope" Category="Microsoft.Reliability" CheckId="CA2000" Status="Active" Created="2015-01-19 13:37:17Z" FixCategory="DependsOnFix" BreaksBuild="True">
<Issue Name="ExceptionEdge" Certainty="75" Level="Warning" Path="c:\Projects\ProjectA" File="WebEdition.ascx.cs" Line="71">In method 'WebEdition.TypeDeclar()', object 'sqlcmd' is not disposed along all exception paths. Call System.IDisposable.Dispose on object 'sqlcmd' before all references to it are out of scope.</Issue>
<Issue Name="ExceptionEdge" Certainty="75" Level="Warning" Path="c:\Projects\ProjectA" File="WebEdition.ascx.cs" Line="69">In method 'WebEdition.TypeDeclar()', object 'sqlconn' is not disposed along all exception paths. Call System.IDisposable.Dispose on object 'sqlconn' before all references to it are out of scope.</Issue>
</Message>
<Message TypeName="Do not dispose objects multiple times" Category="Microsoft.Usage" CheckId="CA2202" Status="Active" Created="2015-01-19 13:37:17Z" FixCategory="DependsOnFix" BreaksBuild="True">
<Issue Certainty="75" Level="Warning" Path="c:\Projects\ProjectA" File="WebEdition.ascx.cs" Line="92">Object 'sqlconn' can be disposed more than once in method 'WebEdition.TypeDeclar()'. To avoid generating a System.ObjectDisposedException you should not call Dispose more than one time on an object.: Lines: 92</Issue>
</Message>
</Messages>
希望有人注意到我想念的东西!!! 谢谢。
【问题讨论】:
标签: c# asp.net sonarqube code-analysis fxcopcmd