我熟悉MSDN 列表,但我想要一个按代码排序的列表。我们的许多开发人员无法轻松访问互联网,如果我能为他们提供离线完整的警告列表,那就太好了。
我希望它们按警告代码排序,因为这是它们识别 Fxcop 日志文件中问题的方式。
我正在尝试FxCop(暂时通过UI,不包括在CruiseControl.NET等中)并且遇到了一些问题.似乎拼写检查器不喜欢我的客户的公司名称和产品名称,它要求我:
Correct the spelling of 'CompanyName' in namespace
name 'CompanyName.Product.TimerJobs.FeatureReceivers'.
Run Code Online (Sandbox Code Playgroud)
ObjectDataSource因此它们需要保留荷兰语,因为客户需要),我可以以某种方式将荷兰语库添加到FxCop吗?编辑
我找到了CustomDictionary.xml,但这被认为是最佳做法吗?如果有更多的人加入团队,他们需要一本字典副本,还是更好地转向持续集成?
我正在尝试编写一个FxCop规则,该规则匹配使用Serializable属性装饰的类,但似乎该属性被忽略.
例如.给出这个样本类
[Serializable]
[Description]
public class ClassWithSerializableMustHaveSerializableBaseClass : BaseClass
{
}
Run Code Online (Sandbox Code Playgroud)
我原以为我的自定义规则中的代码会成功匹配:
public override ProblemCollection Check(TypeNode type)
{
if (type.Attributes.Any(a => a.Type.FullName == typeof(SerializableAttribute).FullName))
{
var problem = new Problem(GetResolution(), type.SourceContext);
Problems.Add(problem);
}
return Problems;
}
Run Code Online (Sandbox Code Playgroud)
但事实并非如此.如果我将匹配类型更改为DescriptionAttribute,那么它确实有效.有关SerializableAttribute的神奇之处还是我错过了一些明显的东西?
我有 C# 代码,当我针对它运行 FXCop 时,它产生了一个奇怪的错误,我试图理解但我不能理解。错误说
透明方法不能满足链接需求。
这里我不明白的是什么是透明方法?在通过 MSDN 帮助时,我遇到了一个称为透明类的术语。
谁能解释一下透明类或透明方法是什么意思?
我正在尝试为 FxCop 编辑自定义规则集文件。当我打开规则集文件时,我收到以下消息:
Width of the image strip must be a positive multiple of
ImageSize.Width
Parameter name: value
Run Code Online (Sandbox Code Playgroud)
该文件似乎已打开,因为当我尝试以 XML 格式进行编辑时,它会询问我是否要先关闭它。我也不能编辑为 XML。
我有一个问题FxCop和警告:Abstract types should not have constructors.
这是为许多抽象类显示的(可能所有,我还没有检查过).当我看起来他们中的大多数没有新的方法所以我认为它是编译器添加默认方法.所以要删除它我添加一个私有默认Private Sub New()的constuctor (),这意味着所有的inherting类都无法构建错误:
Class 'InheritingClass' has no accessible 'Sub New' and cannot be inherited.
这似乎很奇怪,因为FxCop请求没有公共构造函数,但是当我删除它时,构建失败.
前一段时间使用MSBuild任务,并找到了一些关于能够排除特定规则的文档,例如-Microsoft.Design#CA2210.MSBuild任务将其转换为/rule:-Microsoft.Design#CA2210.
我们现在在TeamCity中使用FXCop构建运行器,并将该参数添加到其他命令行参数中失败:
无法加载规则文件'-Microsoft.Design#CA2210; -Microsoft.Design#CA1020':无法找到指定的文件.
看来这个论点是指定规则集,而不是单个规则.可以这样做吗?
如何抑制Style Cop规则SP0100?
枚举项名称v2007不符合指定的样式:SampleName,Sample_Name.
我尝试了以下/sf/answers/230730671/
[SuppressMessage("SP0100")]
Run Code Online (Sandbox Code Playgroud)
但是我收到了一个错误
'System.Diagnostics.CodeAnalysis.SuppressMessageAttribute'不包含带有1个参数的构造函数
使用C#内置插件(版本4.0)在C#sln上执行Sonar(版本4.5.4)分析.我在设置中设置了FxCopCmd.exe的位置,但是我在执行中得到以下内容:"禁用所有FxCop规则,跳过其执行"如何启用规则?
谢谢,
阿里尔
当在QualityProfile中使用FxCop规则时,MSBuild SonarQube提出了“必须设置sonar.cs.fxcop.assembly”的问题。请参阅下面的异常。
它可以与其他StyleCop和C#规则配合使用。我看过类似的帖子,但找不到解决方案。
我在用 :
C:\Sonar\sonarqube-5.2
C:\Sonar\MSBuild.SonarQube.Runner-1.0.2
Run Code Online (Sandbox Code Playgroud)
已安装以下插件:插件C#4.3插件StyleCop 1.1
针对以下示例项目:
C:\Sonar\sonar-examples-master\projects\languages\csharp\ConsoleApplication1
Run Code Online (Sandbox Code Playgroud)
我正在执行以下命令:
cd Sonar\MSBuild.SonarQube.Runner-1.0.2\
MSBuild.SonarQube.Runner.exe begin /k:"MyProjectKey" /n:"MyProjectName" /v:"MyProjectVersion"
"C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe" "C:\Sonar\sonar-examples-master\projects\languages\csharp\ConsoleApplication1\ConsoleApplication1.csproj" /t:Rebuild
MSBuild.SonarQube.Runner.exe end
Run Code Online (Sandbox Code Playgroud)
我试图在.csproj文件中声明程序集的位置,但是没有成功。预期路径是什么样的?
<ItemGroup>
<SonarQubeSetting Include="sonar.cs.fxcop.assembly">
<Value>path to dll</Value>
</SonarQubeSetting>
</ItemGroup>
Run Code Online (Sandbox Code Playgroud)
谢谢您的帮助 !
例外情况:
10:33:14.564 INFO - Sensor org.sonar.plugins.csharp.CSharpFxCopProvider$CSharpF
xCopSensor@1eeeda8
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 12.017s
Final Memory: 14M/113M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher
.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69) …Run Code Online (Sandbox Code Playgroud)