Eclipse count lines of code

后端 未结 10 1037
孤城傲影
孤城傲影 2021-01-29 19:06

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 wa

10条回答
  •  清酒与你
    2021-01-29 19:14

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

    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 {}.

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

    This metric represents the number of statements in a method. I consider it a more robust measure than Lines of Code since the latter is fragile with respect to different formatting conventions.

    Edit:

    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.

提交回复
热议问题