Eclipse计数代码行 [英] Eclipse count lines of code

查看:154
本文介绍了Eclipse计数代码行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试过 Metrics插件,虽然很好,所有这些都不是我老板在寻找的。它只计算一条} 作为一行,他不希望将其视为它不是一行,它的风格选择。我还需要生成关于提供的指标的某种形式的报告。有没有什么好的工具?

I've tried the Metrics plugin and although it's nice and all, it's not what my boss is looking for. It counts a line with just one } as a line and he doesn't want that to count as "its not a line, its a style choice". I also need to generate some form of report about the metrics provided. Are there any good tools for this?

推荐答案

安装 Eclipse Metrics插件。要创建HTML报告(可选的XML和CSV)右键单击项目 - >导出 - >其他 - >指标

Install the Eclipse Metrics Plugin. To create a HTML report (with optional XML and CSV) right-click a project -> Export -> Other -> Metrics.

您可以通过忽略空白和仅注释行来排除代码行指标,或者如果需要排除Javadoc。为此,请检查首选项 - >上的选项卡。指标 - > LoC

You can adjust the Lines of Code metrics by ignoring blank and comment-only lines or exclude Javadoc if you want. To do this check the tab at Preferences -> Metrics -> LoC.

就是这样。没有特殊的选择来排除花括号 {}

That's it. There is no special option to exclude curly braces {}.

插件为LoC提供了一个替代指标, a href =http://eclipse-metrics.sourceforge.net/descriptions/pages/NumberOfStatements.html>语句数量。这是作者不得不说的:

The plugin offers an alternative metric to LoC called Number of Statements. This is what the author has to say about it:


此度量表示方法中的语句数。我认为这是一个比线条更强大的措施,因为后者对于不同的格式化约定是脆弱的。

编辑:

在澄清了您的问题后,我了解您需要查看实时指标违规,如编译器警告或错误。您还需要报告功能为您的老板创建报告。我上面介绍的插件是报告,因为您要查看它们时必须导出指标。

After you clarified your question, I understand that you need a view for real-time metrics violations, like compiler warnings or errors. You also need a reporting functionality to create reports for your boss. The plugin I described above is for reporting because you have to export the metrics when you want to see them.

这篇关于Eclipse计数代码行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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