We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(5)
DrivenMetrics 是一个开源 C# 命令行工具。 核心功能作为库与命令行控制台客户端隔离(核心项目可用 这里)。
即使非常简单,它也可能满足您的需求:它是免费的,计算行数并计算方法的圈复杂度(潜在代码路径的数量)。
这是通过直接分析 IL 来执行的,这要归功于 Mono.Cecil (NDepend 依赖于相同的库) )。 这允许对用 C#、VB.Net 编写的代码构建的程序集执行分析...
此处。
可以在 github 上找到。
更新:
另一个选择是惊人的Gendarme,它是来自Mono项目的静态分析工具。
作为用法示例,下面的代码显示了程序集中每个方法的圈复杂度。
DrivenMetrics is a open source C# command line tool. The core functionalities are isolated from the command line console client as a library (Core project is available here).
Even if quite simple, it may fit your need: it's free, counts the the number of lines and calculates the cyclomatic complexity (number of potential code paths) of methods.
This is performed through direct analysis of the IL thanks to Mono.Cecil (the same library NDepend relies on). This allows the analysis to be performed on assemblies built from code written in C#, VB.Net,...
here.
available on github.
UPDATE:
Another option would be the amazing Gendarme, a static analysis tool from the Mono project.
As a sample of usage, the code below display the cyclomatic complexity of every method in an assembly.
我正在使用 SourceMonitor,这是一个很好的免费软件应用程序,可以测量代码复杂性和其他指标多种语言,包括 C#。 我们从命令行驱动它以生成 XML 输出,然后使用 LINQ to XML 提取和排序我们感兴趣的数据。然后使用 NVelocity 创建 HTML 报告。
我知道它不是一个托管库,但您可能会发现它可以满足您的需要。
I am using SourceMonitor, which is a nice freeware app that measures code complexity and other metrics for a variety of languages including C#. We drive it from the command line to produce XML output, then we use LINQ to XML to extract and sort the data we are interested in. We then use NVelocity to create HTML reports.
I know its not a managed library, but you might find it can do what you need.
我正在使用 Microsoft 的一个工具来计算 C# 程序集的代码指标。
包括环路综合体、可维护性指标等。
详细信息请参见:
http://blogs.msdn.com/b/camerons/archive/2011/01/28/code-metrics-from-the-command-line.aspx
在此处下载:
http://www.microsoft.com/en-us/download/details.aspx?id=9422
There is a tool from Microsoft I am using to compute code metrics for C# assemblies.
It includes cyclo complex, maintainability index and more.
Details here:
http://blogs.msdn.com/b/camerons/archive/2011/01/28/code-metrics-from-the-command-line.aspx
Download here:
http://www.microsoft.com/en-us/download/details.aspx?id=9422
它不是免费的,但我在 NCover 处理此类事情方面获得了很好的经验。 它们还与许多 CI 工具集成得很好。
It isn't free but I've had good experiences with NCover for this sort of thing. They also integrate pretty well with a lot of CI tools out there.
NDepend 支持 82 个代码指标,是 Roll 为 .NET 开发人员提供的代码指标工具(但是它是一个商业工具)。
With 82 code metrics supported NDepend is the code metrics Roll's Royce tooling for .NET developers (however it is a commercial tool).