Eclipse count lines of code
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.
There's always the "brute force":
Search->File
Type the following in "Containing text" ->
^.*$
. Then check the "Regular Expression" checkboxType the following in "File name patterns" ->
*.java
Click "Search"
Check the number of matches in the "Search" Tab.