许多 C# 解决方案的代码行数计数
我目前正在研究一种计算 C# 代码行数的解决方案。
我非常需要以下两个工具的组合:
http://richnewman.wordpress.com/ 2007/07/01/c-and-vbnet-line-count-utility/
http://www.locmetrics.com/index.html
我的问题是我需要递归扫描包含大量 Visual Studio 解决方案的文件夹。因此,如果不对代码进行任何重大工作,就无法真正使用第一个工具,因为它一次只能扫描一个解决方案。
但我还需要拆分每个解决方案的结果,最好是包含的项目。这使我发现的第二个工具失去了资格。我还发现 NDepend 也遇到同样的问题。
您知道有哪些免费工具可以满足我的需要吗?我找不到任何合适的东西。
I am currently researching a solution for counting lines of code in C#.
I pretty much need a combination of the following two tools:
http://richnewman.wordpress.com/2007/07/01/c-and-vbnet-line-count-utility/
http://www.locmetrics.com/index.html
My problem is that I need to recursively scan a folder containing a lot of visual studio solutions. So can't really use the first tool without any major work on its code, as it's only able to scan a single solution at a time.
But I also need to split the results for each solution, preferably even the contained projects. This disqualifies the second tool I found. I also found NDepend which suffers from the same problem.
Do you know of any free tools that do what I need? I am unable to find anything suitable.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
NDepend 是一款出色的工具,旨在测量和可视化代码指标和复杂性。
Powershell 会这样做:
计数PowerShell 中的源代码行数:
每个路径的行数:
最小/最大/平均值:
评论率:
此外,行计数器
NDepend is a great tool designed for measuring and visualising code metrics and complexity.
Powershell would do it:
Counting Lines of Source Code in PowerShell:
Line count per path:
Min / Max / Averages:
Comment ratio:
Also, Line Counter
我认为 LOCcode 是一个有趣的免费计数工具代码行数。它允许选择必须处理哪些文件。它计算所有已启用任务中的 LOC。
不幸的是,LOCCode 的开发似乎已经结束。
I think LOCcode is an interesting free tool for counting number of Lines Of Code. It allows to choose which of files must be processed. It counts LOC in all enabled tasks.
Unfortunately, it seems that development of LOCCode is over.
您需要的是如下定义的逻辑代码行计数:
如何计算代码行数 (LOC)
如果您使用 NDepend 来计算 代码行数代码,您仍然可以将所有 VS sln 附加到 NDepend 项目中。然而,逻辑代码行是从 PDB 文件推断的指标,因此请确保所有程序集都具有关联的相应 PDB 文件。
您可能还对以下内容感兴趣:为什么计算代码行数 (LOC) 很有用?
What you need is logical lines of code counting as defined here:
How do you count your number of Lines Of Code (LOC)
If you use NDepend to count your number of lines of code you can still append all your VS sln in a NDepend project. However logical lines of code is a metric inferred from PDB files so make sure that all your assemblies have corresponding PDB files associated.
Also you might be interested by:Why is it useful to count the number of Lines Of Code (LOC) ?
我喜欢 Mitch Wheat 所说的,但我不喜欢一些无用的信息被计算为“代码行”。我编写了一段 C# 代码来查找代码中的 REAL 行总数:
http://rajputyh.blogspot .in/2014/02/counting-number-of-real-lines-in-your-c.html
您需要用该代码构建一个小型实用程序来提供保存所有“*.cs”文件的根文件夹。该代码的好处是它不依赖于项目文件。我通常检查我的代码并删除自动生成的文件,然后使用该工具来计算行数。
I liked what Mitch Wheat has said but I don't like some useless information is calculated as 'line of code'. I've written a C# code to find total number of REAL lines in the code here:
http://rajputyh.blogspot.in/2014/02/counting-number-of-real-lines-in-your-c.html
You need to build a small utility out of that code to provide path of your root folder where all "*.cs" files are kept. Good thing about that code is that it is not dependent upon the project file. I generally check-out my code and delete auto generated files and the use the tool to count number of lines.
最后我选择了LocMetrics,不幸的是这并没有真正解决我的每个解决方案的问题。
但存储库的文件夹结构足以很好地映射到解决方案,因此我决定使用上面的工具。
感谢大家的帮助
In the end I went with LocMetrics, unfortunately this didn't really solve my per-solution problem.
But the folder structure of the reposiotry maps well enough to solutions so I was decided to use the tool above.
Thanks everybody for helping