在Visual Studio 2012中使用StyleCop c# [英] using StyleCop in Visual Studio 2012 c#

查看:241
本文介绍了在Visual Studio 2012中使用StyleCop c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,



按照规则设置,stylecop会修改或安排我们的C#代码吗?...

或者它只会显示错误和警告?....

我们自己需要说清楚吗??。

谢谢

Jim

Hi friends,

Does the stylecop modify or arrange our C# code as per the rules set?...
Or it will just show the errors and warnings?....
do we ourself need to make it clear??.
Thanks
Jim

推荐答案

StyleCop与Visual Studio集成,可从工具菜单访问。在安装过程中,您可以选择StyleCop是与Visual Studio,还是MS Build集成,或两者兼而有之。



它不会自动更改您的源代码!



当你运行它时,它会写一个摘要报告,说明你违反了多少规则。这将写入'Visual Studio的输出窗口。



特定的错误消息将写入错误列表窗口。



StyleCop,使用其默认设置,可能会使您在代码中发现的内容感到惊讶:



1它会将Tab字符的使用标记为违规



2.它想要'在NameSpace中使用指令



3.它真的希望看到你使用'this作为对象引用的前缀,即使你的代码运行正常而不使用'this。



I使用StyleCop一段时间,但只是厌倦了它;但是,我目前不是一个编程团队的成员,每个人都遵守一套特定的代码指南是至关重要的。



你可以将StyleCop配置为你的通过删除规则等来品味。



有关自定义它的信息,请参阅StyleCop文档:[ ^ ]。
StyleCop integrates with Visual Studio, and is accessible from the 'Tools Menu. During the install you can choose whether StyleCop integrates with Visual Studio, or MS Build, or both.

It does not automatically change your source code !

When you run it, it will write a summary report on how many of its "rules" you have violated. This is written to the 'Output Window of Visual Studio.

The specific error messages are written to the "Error List" window.

StyleCop, using its default settings, may surprise you by what it finds in your code:

1. it will flag uses of the Tab character as a violation

2. it wants 'using directives inside the NameSpace

3. it really wants to see you use 'this as a prefix to object references even though your code will run fine without using 'this.

I used StyleCop for a while, but just got tired of it; however, I am not currently part of a programming team where having everyone conform to a certain set of code guidelines is critical.

You can configure StyleCop, however, to your taste by removing rules, etc.

See the StyleCop docs for information on customizing it: [^].


这篇关于在Visual Studio 2012中使用StyleCop c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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