C#源代码分析工具

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/389968/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-04 01:38:24  来源:igfitidea点击:

Source code analysis tools for C#

c#

提问by

Possible Duplicate:
What static analysis tools are available for C#?

可能的重复:
哪些静态分析工具可用于 C#?

Guys, I'm looking for an open source or free source code analysis tool for C#. The tool should be able to generate metrics from the source code such as cyclomatic complexity, number of lines, number of commented lines, SEI maintainability etc. Does anyone know of any such tool?

伙计们,我正在寻找 C# 的开源或免费源代码分析工具。该工具应该能够从源代码生成指标,例如圈复杂度、行数、注释行数、SEI 可维护性等。有人知道任何这样的工具吗?

采纳答案by AlexCuse

There are many plugins for reflector (which is also free):

反射器有很多插件(也是免费的):

Reflector Add-Ins

反射器插件

I believe the CodeMetrics plugin does what you need

我相信 CodeMetrics 插件可以满足您的需求

回答by Jeremy Frey

NDependisn't free for non-academic or open-source software use, but it is awesome, and will give you those metrics (and many others, using its built-in Code Query Language).

NDepend对于非学术或开源软件的使用不是免费的,但它很棒,并且会为您提供这些指标(以及许多其他指标,使用其内置的代码查询语言)。

This question is more or less a dupe of this one: Calculate code metrics, and you'll find an entire series of good suggestions there.

这个问题或多或少是对这个问题的欺骗:Calculate code metrics,你会在那里找到一整套好的建议。

回答by Dave R.

NDepend will give you a vast number of stats for your code:

NDepend 将为您的代码提供大量统计信息:

http://codebetter.com/blogs/patricksmacchia/archive/2008/11/25/composing-code-metrics-values.aspx

http://codebetter.com/blogs/patricksmacchia/archive/2008/11/25/composing-code-metrics-values.aspx

There is a free 'Trial' version which contains fewer features than the Professional product, but which is free to use for Open Source and Academic development. The Trial version on the download page gets updated with a new version before the previous one runs out:

有一个免费的“试用版”,它包含的功能少于专业版产品,但可免费用于开源和学术开发。下载页面上的试用版会在前一个版本用完之前更新为新版本:

http://www.ndepend.com/NDependDownload.aspx

http://www.ndepend.com/NDependDownload.aspx

回答by Sun Liwen

Gendarmeis totally open source and free. It's a subproject under mono. You can run the tools in three ways: wizard, console, NAnt. It will generate a html report which summarize all the violated rules. Worthy have a look.

Gendarme是完全开源和免费的。这是mono下的一个子项目。您可以通过三种方式运行这些工具:向导、控制台、NAnt。它将生成一个 html 报告,其中总结了所有违反的规则。值得一看。

回答by codingoutloud

Most of these capabilities are included with Visual Studio 2008 Team System.

大多数这些功能都包含在 Visual Studio 2008 Team System 中。

Under the Tools | Analyze menu there are options for Code Metrics. Most of your desired features are all there: Cyclomatic Complexity, LOC, and Microsoft's (a variant of the SEI maintainability index that instead goes from 0-100, where 100 is most maintainable) - as well as Depth of Inheritance, and Class Coupling as bonus features. It does not include number of commented lines.

在工具下 | 分析菜单有代码度量的选项。您想要的大部分功能都在那里:圈复杂度、LOC 和 Microsoft 的(SEI 可维护性指数的变体,从 0 到 100,其中 100 是最可维护的)-以及继承深度和类耦合作为奖金功能。它不包括注释行的数量。

回答by Mark Dalgarno

Axivion Bauhaus Suiteis free for academic use but not for commercial use.

Axivion Bauhaus Suite可免费用于学术用途,但不可用于商业用途。

It includes:

这包括:

  • Software Architecture visualization
  • Software Architecture rule checking
  • Interface analysis
  • Cycle detection
  • Clone (copy) detection
  • Dead code detection
  • Detection of code style violations
  • A full set of predefined software metrics
  • The ability to add your own metrics and analyses...
  • 软件架构可视化
  • 软件架构规则检查
  • 界面分析
  • 循环检测
  • 克隆(拷贝)检测
  • 死码检测
  • 检测代码风格违规
  • 一套完整的预定义软件指标
  • 添加您自己的指标和分析的能力...

Supports C / C++, C#, Java on various platforms

支持各种平台上的C/C++、C#、Java

回答by Igor Brejc

SourceMonitoris a free C# metrics tool, it's fairly old but it could still be useful.

SourceMonitor是一个免费的 C# 指标工具,它相当古老,但仍然很有用。

回答by viggity

I wrote a (completely) free code analysis app for .Net - Nitriq

我为 .Net 编写了一个(完全)免费的代码分析应用程序 - Nitriq