SourceAnalysis(StyleCop)可以作为 Visual studio 的插件运行.

  同时SourceAnalysis (StyleCop)也可以作为 MSBuild 任务(安装时有选项)通过命令行执行。

  SourceAnalysis(StyleCop)是代码级别的,更适合于程序员在编程过程中使用。

  SourceAnalysis(StyleCop)不提供灵活的规则设置,而是使用所谓 one-size-fits-all的方式强制人们用同样的习惯书写代码,因此 SourceAnalysis (StyleCop)的终极目标是:The ultimate goal of Source Analysis is to allow you to produce elegant,consistent code that your team members and others who view your code will findhighly readable.

  SourceAnalysis(StyleCop)检查的规则包括:

           布局(Layout of elements, statements,expressions, and query clauses )

           括号位置(Placement of curly brackets,parenthesis, square brackets, etc )

           空格(Spacing around keywords andoperator symbols )

          

           参数位置(Placement of method parameterswithin method declarations or method calls )

           元素标准排列(Standard ordering of elementswithin a class )

           注释格式(Formatting of documentationwithin element headers and file headers )

           命名(Naming of elements, fields andvariables )


           访问修饰符的使用(Use of access modifiers )

           文件内容(Allowed contents of files )

           Debugging文本(Debugging text)

         原文地址:​​原文地址​

         工具下载地址:​​工具下载地址​

使用图例如下:

使用StyleCop进行代码审查_vs工具