get LOC (Lines of code) in a java file

Does anyone knows APIs or a way to get loc (lines of code) or number of ast nodes or psi elements of a java file. I need that to do some statistics. Thanks.

1 comment
Comment actions Permalink

There is an existing plugin that can calculate all sorts of statistics for your code: https://plugins.jetbrains.com/plugin/93?pr=

If the plugin doesn't do what you need, you can check its source code and customize it to your requirements.

0

Please sign in to leave a comment.